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);
_______________________________________________
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