Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 May 2011 02:00:35 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r221570 - stable/8/sys/kern
Message-ID:  <201105070200.p4720ZYE075925@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat May  7 02:00:35 2011
New Revision: 221570
URL: http://svn.freebsd.org/changeset/base/221570

Log:
  MFC: r220967
  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.

Modified:
  stable/8/sys/kern/vfs_subr.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/vfs_subr.c
==============================================================================
--- stable/8/sys/kern/vfs_subr.c	Sat May  7 01:05:31 2011	(r221569)
+++ stable/8/sys/kern/vfs_subr.c	Sat May  7 02:00:35 2011	(r221570)
@@ -380,9 +380,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?201105070200.p4720ZYE075925>