summaryrefslogtreecommitdiff
path: root/sys/miscfs
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-01-28 23:53:58 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-01-28 23:53:58 +0000
commit309d6b50c369bf00a86081d7eaee15170addf019 (patch)
tree0da21fab04e0096b8ddd984bea6d795976eaa4a3 /sys/miscfs
parent788cd70f51830f3724d4f12119f27f5d8a79a95f (diff)
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).
Diffstat (limited to 'sys/miscfs')
-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);