aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorJeff Roberson <jeff@FreeBSD.org>2006-02-22 06:20:12 +0000
committerJeff Roberson <jeff@FreeBSD.org>2006-02-22 06:20:12 +0000
commit8a7cd2fdfbde9b79182ab9b5c6efb044d4690d3a (patch)
tree3db78d9e03a344a49a4399f655f33ecdf52ec910 /sys/kern/vfs_subr.c
parent05b6a20a66cf664523cbd326ad7327a08d0938c2 (diff)
downloadsrc-8a7cd2fdfbde9b79182ab9b5c6efb044d4690d3a.tar.gz
src-8a7cd2fdfbde9b79182ab9b5c6efb044d4690d3a.zip
- Grab a mnt ref in vfs_busy() before dropping the interlock. This will
prevent the mount point from going away while we're waiting on the lock. The ref does not need to persist once we have the lock because the lock prevents the mount point from being unmounted. MFC After: 1 week
Notes
Notes: svn path=/head/; revision=155901
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 5017c72ad3d3..7cd93a3d3413 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -337,8 +337,10 @@ vfs_busy(struct mount *mp, int flags, struct mtx *interlkp,
int lkflags;
MNT_ILOCK(mp);
+ MNT_REF(mp);
if (mp->mnt_kern_flag & MNTK_UNMOUNT) {
if (flags & LK_NOWAIT) {
+ MNT_REL(mp);
MNT_IUNLOCK(mp);
return (ENOENT);
}
@@ -351,7 +353,9 @@ vfs_busy(struct mount *mp, int flags, struct mtx *interlkp,
* wakeup needs to be done is at the release of the
* exclusive lock at the end of dounmount.
*/
- msleep(mp, MNT_MTX(mp), PVFS|PDROP, "vfs_busy", 0);
+ msleep(mp, MNT_MTX(mp), PVFS, "vfs_busy", 0);
+ MNT_REL(mp);
+ MNT_IUNLOCK(mp);
if (interlkp)
mtx_lock(interlkp);
return (ENOENT);
@@ -361,6 +365,7 @@ vfs_busy(struct mount *mp, int flags, struct mtx *interlkp,
lkflags = LK_SHARED | LK_INTERLOCK;
if (lockmgr(&mp->mnt_lock, lkflags, MNT_MTX(mp), td))
panic("vfs_busy: unexpected lock failure");
+ vfs_rel(mp);
return (0);
}