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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to