summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-01-28 23:53:57 +0000
committermillert <millert@openbsd.org>2004-01-28 23:53:57 +0000
commit6c23a71cf52aa8a2a67277be7ca29001194d12bf (patch)
treeb5b1486aae3af55add0865bc6a6768f8939edfff
parentDo not put the sample IndustryPack driver in GENERIC. This makes no real sense. (diff)
downloadwireguard-openbsd-6c23a71cf52aa8a2a67277be7ca29001194d12bf.tar.xz
wireguard-openbsd-6c23a71cf52aa8a2a67277be7ca29001194d12bf.zip
Don't rely on vp->v_usecount to tell when we can dispose of our resources
in fifo_close(). If the FIFO is accessed via a layed fs (e.g. nullfs), v_usecount will always be 1. Instead, just check fip->if_readers and fip->fi_writers. If either one is non-zero we know the FIFO is in use and we should not free up its resources. Adapted from FreeBSD, NetBSD has an equivalent change (but they keep a counter instead).
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index 71a606bec48..0fecb45b806 100644
--- a/sys/miscfs/fifofs/fifo_vnops.c
+++ b/sys/miscfs/fifofs/fifo_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fifo_vnops.c,v 1.16 2003/09/23 16:51:13 millert Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.17 2004/01/28 23:53:57 millert Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
@@ -439,7 +439,7 @@ fifo_close(v)
if (--fip->fi_writers == 0)
socantrcvmore(fip->fi_readsock);
}
- if (vp->v_usecount > 1)
+ if (fip->fi_readers != 0 || fip->fi_writers != 0)
return (0);
error1 = soclose(fip->fi_readsock);
error2 = soclose(fip->fi_writesock);