Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Apr 2011 11:22:49 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220967 - head/sys/kern
Message-ID:  <201104231122.p3NBMnHk087354@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat Apr 23 11:22:48 2011
New Revision: 220967
URL: http://svn.freebsd.org/changeset/base/220967

Log:
  Fix a LOR in vfs_busy() where, after msleeping, it would lock
  the mutexes in the wrong order for the case where the
  MBF_MNTLSTLOCK is set. I believe this did have the
  potential for deadlock. For example, if multiple nfsd threads
  called vfs_busyfs(), which calls vfs_busy() with MBF_MNTLSTLOCK.
  Thanks go to pho for catching this during his testing.
  
  Tested by:	pho
  Submitted by:	kib
  MFC after:	2 weeks

Modified:
  head/sys/kern/vfs_subr.c

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Apr 23 06:37:09 2011	(r220966)
+++ head/sys/kern/vfs_subr.c	Sat Apr 23 11:22:48 2011	(r220967)
@@ -377,9 +377,10 @@ vfs_busy(struct mount *mp, int flags)
 		if (flags & MBF_MNTLSTLOCK)
 			mtx_unlock(&mountlist_mtx);
 		mp->mnt_kern_flag |= MNTK_MWAIT;
-		msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0);
+		msleep(mp, MNT_MTX(mp), PVFS | PDROP, "vfs_busy", 0);
 		if (flags & MBF_MNTLSTLOCK)
 			mtx_lock(&mountlist_mtx);
+		MNT_ILOCK(mp);
 	}
 	if (flags & MBF_MNTLSTLOCK)
 		mtx_unlock(&mountlist_mtx);



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