svn commit: r270797 - head/sys/ufs/ufs

Konstantin Belousov kib at FreeBSD.org
Fri Aug 29 09:04:24 UTC 2014


Author: kib
Date: Fri Aug 29 09:04:24 2014
New Revision: 270797
URL: http://svnweb.freebsd.org/changeset/base/270797

Log:
  Direct access to the quota files, in particular, lookup, causes lock
  conflict with the quota metadata access.  Mark quota vnode lock as
  recursive and always exclusive to avoid the problem.
  
  Reported by:	hrs
  Tested by:	hrs, pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/ufs/ufs/ufs_quota.c

Modified: head/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- head/sys/ufs/ufs/ufs_quota.c	Fri Aug 29 09:03:17 2014	(r270796)
+++ head/sys/ufs/ufs/ufs_quota.c	Fri Aug 29 09:04:24 2014	(r270797)
@@ -557,8 +557,21 @@ quotaon(struct thread *td, struct mount 
 	if (*vpp != vp)
 		quotaoff1(td, mp, type);
 
+	/*
+	 * When the directory vnode containing the quota file is
+	 * inactivated, due to the shared lookup of the quota file
+	 * vput()ing the dvp, the qsyncvp() call for the containing
+	 * directory would try to acquire the quota lock exclusive.
+	 * At the same time, lookup already locked the quota vnode
+	 * shared.  Mark the quota vnode lock as allowing recursion
+	 * and automatically converting shared locks to exclusive.
+	 *
+	 * Also mark quota vnode as system.
+	 */
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
 	vp->v_vflag |= VV_SYSTEM;
+	VN_LOCK_AREC(vp);
+	VN_LOCK_DSHARE(vp);
 	VOP_UNLOCK(vp, 0);
 	*vpp = vp;
 	/*


More information about the svn-src-head mailing list