summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpedro <pedro@openbsd.org>2007-01-21 15:52:39 +0000
committerpedro <pedro@openbsd.org>2007-01-21 15:52:39 +0000
commitb7b2d5c7d827d1109f7bcee38da9a2fbe4f4e00a (patch)
tree47c30a02248fe8172e8f0323646a2d5128e039f0
parentadd support for the -A flag; (diff)
downloadwireguard-openbsd-b7b2d5c7d827d1109f7bcee38da9a2fbe4f4e00a.tar.xz
wireguard-openbsd-b7b2d5c7d827d1109f7bcee38da9a2fbe4f4e00a.zip
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,