summaryrefslogtreecommitdiff
path: root/sys/ufs/mfs
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/ufs/mfs
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/ufs/mfs')
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c41
1 files changed, 4 insertions, 37 deletions
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index 36989eab1fb..9f784417eb0 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfs_vfsops.c,v 1.10 1999/10/15 15:16:13 art Exp $ */
+/* $OpenBSD: mfs_vfsops.c,v 1.11 1999/12/06 07:28:06 art Exp $ */
/* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */
/*
@@ -66,9 +66,6 @@ static int mfs_minor; /* used for building internal dev_t */
extern int (**mfs_vnodeop_p) __P((void *));
-int mfs_dounmount __P((struct mount *));
-void mfs_dounmount1 __P((void *));
-
/*
* mfs vfs operations.
*/
@@ -276,8 +273,9 @@ mfs_start(mp, flags, p)
* EINTR/ERESTART.
*/
if (tsleep((caddr_t)vp, mfs_pri, "mfsidl", 0)) {
- mfs_dounmount(mp);
- CLRSIG(p, CURSIG(p));
+ if (vfs_busy(mp, LK_NOWAIT, NULL, p) ||
+ dounmount(mp, 0, p))
+ CLRSIG(p, CURSIG(p));
}
}
return (0);
@@ -301,34 +299,3 @@ mfs_statfs(mp, sbp, p)
&sbp->mount_info.mfs_args, sizeof(struct mfs_args));
return (error);
}
-
-/*
- * Spawn off a kernel thread to do the unmounting to avoid all deadlocks.
- * XXX - this is horrible, but it was the only sane thing to do.
- */
-int
-mfs_dounmount(mp)
- struct mount *mp;
-{
- if (kthread_create(mfs_dounmount1, (void *)mp, NULL, "mfs_unmount"))
- return 1;
-
- return 0;
-}
-
-void
-mfs_dounmount1(v)
- void *v;
-{
- struct mount *mp = v;
-
- /*
- * Don't try to do the unmount if someone else is trying to do that.
- * XXX - should be done with vfs_busy, but the problem is that
- * we can't pass a locked mp into dounmount.
- */
- if (!(mp->mnt_flag & MNT_UNMOUNT))
- dounmount(mp, 0, curproc);
-
- kthread_exit(0);
-}