Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Dec 2008 16:30:41 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r185798 - in stable/7/sys: . contrib/pf ufs/ufs
Message-ID:  <200812091630.mB9GUf7L095811@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Dec  9 16:30:41 2008
New Revision: 185798
URL: http://svn.freebsd.org/changeset/base/185798

Log:
  MFC r185761:
  Recheck the DQ_MOD after the dqh lock is relocked. Repeat dqsync() if
  the dq is dirty. This ensures that up to date dq is written in the quota
  file and fixes assertion in dqget().
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/ufs/ufs/ufs_quota.c

Modified: stable/7/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_quota.c	Tue Dec  9 16:25:46 2008	(r185797)
+++ stable/7/sys/ufs/ufs/ufs_quota.c	Tue Dec  9 16:30:41 2008	(r185798)
@@ -1321,7 +1321,7 @@ dqrele(vp, dq)
 		return;
 	}
 	DQH_UNLOCK();
-
+sync:
 	(void) dqsync(vp, dq);
 
 	DQH_LOCK();
@@ -1330,6 +1330,18 @@ dqrele(vp, dq)
 		DQH_UNLOCK();
 		return;
 	}
+
+	/*
+	 * The dq may become dirty after it is synced but before it is
+	 * put to the free list. Checking the DQ_MOD there without
+	 * locking dq should be safe since no other references to the
+	 * dq exist.
+	 */
+	if ((dq->dq_flags & DQ_MOD) != 0) {
+		dq->dq_cnt++;
+		DQH_UNLOCK();
+		goto sync;
+	}
 	TAILQ_INSERT_TAIL(&dqfreelist, dq, dq_freelist);
 	DQH_UNLOCK();
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812091630.mB9GUf7L095811>