summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_subr.c
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2005-05-24 05:34:55 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2005-05-24 05:34:55 +0000
commit757d44844da85b55fbad10cfaa740dcfa9b26579 (patch)
treeb565773f8c86f43265cd6aee9d77a8ff03eeb016 /sys/kern/vfs_subr.c
parent2598cb58600de027b684651dbdfea50235604376 (diff)
when a device vnode associated with a mount point disappears, mark the
filesystem as doomed and unmount it
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r--sys/kern/vfs_subr.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7e12ba43a10..0211ad4b60c 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_subr.c,v 1.112 2005/05/22 21:12:42 pedro Exp $ */
+/* $OpenBSD: vfs_subr.c,v 1.113 2005/05/24 05:34:54 pedro Exp $ */
/* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */
/*
@@ -1154,6 +1154,8 @@ vgonel(vp, p)
{
register struct vnode *vq;
struct vnode *vx;
+ struct mount *mp;
+ int flags;
/*
* If a vgone (or vclean) is already in progress,
@@ -1209,6 +1211,20 @@ vgonel(vp, p)
vp->v_flag &= ~VALIASED;
}
simple_unlock(&spechash_slock);
+
+ /*
+ * If we have a mount point associated with the vnode, we must
+ * flush it out now, as to not leave a dangling zombie mount
+ * point laying around in VFS.
+ */
+ mp = vp->v_specmountpoint;
+ if (mp != NULL) {
+ if (!vfs_busy(mp, LK_EXCLUSIVE, NULL, p)) {
+ flags = MNT_FORCE | MNT_DOOMED;
+ dounmount(mp, flags, p, NULL);
+ }
+ }
+
FREE(vp->v_specinfo, M_VNODE);
vp->v_specinfo = NULL;
}