summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>1999-12-06 07:28:07 +0000
committerArtur Grabowski <art@cvs.openbsd.org>1999-12-06 07:28:07 +0000
commitf23efc1cde668047135c6183f3ebc9b35337666e (patch)
tree3871a64a14f3d343483af12d23b116564591aaca /sys/kern
parentb06f4c02a6583aef15b521f3457134bb302b987b (diff)
Yet another solution to the mfs unmount/kill race (not ugly this time).
Require that the mount point is vfs_busy on entry to dounmount.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_syscalls.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index ff4864b0345..50bb7cba61c 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.59 1999/07/30 18:27:47 deraadt Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.60 1999/12/06 07:28:06 art Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -412,6 +412,10 @@ sys_unmount(p, v, retval)
return (EINVAL);
}
vput(vp);
+
+ if (vfs_busy(mp, 0, NULL, p))
+ return (EBUSY);
+
return (dounmount(mp, SCARG(uap, flags), p));
}
@@ -428,13 +432,8 @@ dounmount(mp, flags, p)
int error;
simple_lock(&mountlist_slock);
- if (mp->mnt_flag & MNT_UNMOUNT) {
- mp->mnt_flag |= MNT_MWAIT;
- simple_unlock(&mountlist_slock);
- sleep(mp, PVFS);
- return ENOENT;
- }
mp->mnt_flag |= MNT_UNMOUNT;
+ vfs_unbusy(mp, p);
lockmgr(&mp->mnt_lock, LK_DRAIN | LK_INTERLOCK, &mountlist_slock, p);
mp->mnt_flag &=~ MNT_ASYNC;
#if !defined(UVM)