Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2014 13:25:27 +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-10@freebsd.org
Subject:   svn commit: r271162 - stable/10/sys/ufs/ufs
Message-ID:  <201409051325.s85DPR9f012406@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Sep  5 13:25:27 2014
New Revision: 271162
URL: http://svnweb.freebsd.org/changeset/base/271162

Log:
  MFC r270797:
  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.
  
  Approved by:	re (gjb)

Modified:
  stable/10/sys/ufs/ufs/ufs_quota.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/ufs/ufs/ufs_quota.c
==============================================================================
--- stable/10/sys/ufs/ufs/ufs_quota.c	Fri Sep  5 13:22:28 2014	(r271161)
+++ stable/10/sys/ufs/ufs/ufs_quota.c	Fri Sep  5 13:25:27 2014	(r271162)
@@ -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;
 	/*



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