svn commit: r185802 - in releng/7.1/sys: . ufs/ufs

Konstantin Belousov kib at FreeBSD.org
Tue Dec 9 09:47:01 PST 2008


Author: kib
Date: Tue Dec  9 17:47:00 2008
New Revision: 185802
URL: http://svn.freebsd.org/changeset/base/185802

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:
  releng/7.1/sys/   (props changed)
  releng/7.1/sys/ufs/ufs/ufs_quota.c

Modified: releng/7.1/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- releng/7.1/sys/ufs/ufs/ufs_quota.c	Tue Dec  9 17:33:56 2008	(r185801)
+++ releng/7.1/sys/ufs/ufs/ufs_quota.c	Tue Dec  9 17:47:00 2008	(r185802)
@@ -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();
 }


More information about the svn-src-all mailing list