summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-04-23 11:22:48 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-04-23 11:22:48 +0000
commit872195caf937fd6dc952eeeed83c61258243bb32 (patch)
tree39ec7be656a9fd85e5de051f09d259121956453c /sys/kern
parenta7ea422c215b35f93dc97bc50124c508d23a045b (diff)
downloadFreeBSD-src-872195caf937fd6dc952eeeed83c61258243bb32.zip
FreeBSD-src-872195caf937fd6dc952eeeed83c61258243bb32.tar.gz
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
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_subr.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5809dbb..25bfa7c 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -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);
OpenPOWER on IntegriCloud