summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Martelletto <pedro@cvs.openbsd.org>2007-01-21 15:52:40 +0000
committerPedro Martelletto <pedro@cvs.openbsd.org>2007-01-21 15:52:40 +0000
commit7dfb263fcf2558538f4e3841136e6e34d8a4524b (patch)
tree675bdf4cbcf5cb3bfe62fb9aa34b288e5da79786
parentc36fd441f02bd22d37e91e529cffb4627fcebafa (diff)
don't assume our directory vnode will be flushed out after us, fixes
crash when unmounting nfs volumes, okay thib@, krw@ and mickey@
-rw-r--r--sys/nfs/nfs_vnops.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index d71bdbfe455..9cc06201a50 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.70 2007/01/16 17:52:18 thib Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.71 2007/01/21 15:52:39 pedro Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -1457,7 +1457,16 @@ nfs_removerpc(dvp, name, namelen, cred, proc)
caddr_t bpos, dpos, cp2;
int error = 0, wccflag = NFSV3_WCCRATTR;
struct mbuf *mreq, *mrep, *md, *mb, *mb2;
- int v3 = NFS_ISV3(dvp);
+ int v3;
+
+ /*
+ * It is possible for our directory vnode to have been flushed out
+ * before us. If that's the case, we can't remove the file.
+ */
+ if (dvp->v_type == VBAD)
+ return (EIO);
+
+ v3 = NFS_ISV3(dvp);
nfsstats.rpccnt[NFSPROC_REMOVE]++;
nfsm_reqhead(dvp, NFSPROC_REMOVE,