summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_subr.c18
-rw-r--r--sys/kern/vfs_syscalls.c4
-rw-r--r--sys/sys/mount.h4
3 files changed, 22 insertions, 4 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;
}
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 893e22d1393..694a2f9a549 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.119 2004/12/26 21:22:13 miod Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.120 2005/05/24 05:34:54 pedro Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -454,7 +454,7 @@ dounmount(struct mount *mp, int flags, struct proc *p, struct vnode *olddp)
(flags & MNT_FORCE))
error = VFS_UNMOUNT(mp, flags, p);
simple_lock(&mountlist_slock);
- if (error) {
+ if (error && error != EIO && !(flags & MNT_DOOMED)) {
if ((mp->mnt_flag & MNT_RDONLY) == 0 && hadsyncer)
(void) vfs_allocate_syncvnode(mp);
lockmgr(&mp->mnt_lock, LK_RELEASE | LK_INTERLOCK,
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index caaed936af2..c80ebf69d7f 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.59 2005/03/29 17:24:52 pedro Exp $ */
+/* $OpenBSD: mount.h,v 1.60 2005/05/24 05:34:54 pedro Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -431,6 +431,8 @@ struct mount {
#define MNT_FORCE 0x00080000 /* force unmount or readonly change */
#define MNT_WANTRDWR 0x02000000 /* want upgrade to read/write */
#define MNT_SOFTDEP 0x04000000 /* soft dependencies being done */
+#define MNT_DOOMED 0x08000000 /* device behind filesystem is gone */
+
/*
* Sysctl CTL_VFS definitions.
*