diff options
author | truckman <truckman@FreeBSD.org> | 2003-06-16 17:17:09 +0000 |
---|---|---|
committer | truckman <truckman@FreeBSD.org> | 2003-06-16 17:17:09 +0000 |
commit | 78ee1563afff191a2968fa2a69195f7f0b34028d (patch) | |
tree | 2816372755270811b2dea495b9484caa1117374c | |
parent | 0890e600ee117e8e8ef300248855448556deaa7a (diff) | |
download | FreeBSD-src-78ee1563afff191a2968fa2a69195f7f0b34028d.zip FreeBSD-src-78ee1563afff191a2968fa2a69195f7f0b34028d.tar.gz |
Partially back out rev 1.87 by nuking fifo_inactive() and moving the
resource deallocation back to fifo_close(). This eliminates any
stale data that might be stuck in the socket buffers after all the
readers and writers have closed the fifo.
Tested by: Thorsten Schroeder <ths@katjusha.de>
-rw-r--r-- | sys/fs/fifofs/fifo_vnops.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c index 95c8a9e..c2df25d 100644 --- a/sys/fs/fifofs/fifo_vnops.c +++ b/sys/fs/fifofs/fifo_vnops.c @@ -70,7 +70,6 @@ static int fifo_print(struct vop_print_args *); static int fifo_lookup(struct vop_lookup_args *); static int fifo_open(struct vop_open_args *); static int fifo_close(struct vop_close_args *); -static int fifo_inactive(struct vop_inactive_args *); static int fifo_read(struct vop_read_args *); static int fifo_write(struct vop_write_args *); static int fifo_ioctl(struct vop_ioctl_args *); @@ -98,7 +97,6 @@ static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = { { &vop_create_desc, (vop_t *) vop_panic }, { &vop_getattr_desc, (vop_t *) vop_ebadf }, { &vop_getwritemount_desc, (vop_t *) vop_stdgetwritemount }, - { &vop_inactive_desc, (vop_t *) fifo_inactive }, { &vop_ioctl_desc, (vop_t *) fifo_ioctl }, { &vop_kqfilter_desc, (vop_t *) fifo_kqfilter }, { &vop_lease_desc, (vop_t *) vop_null }, @@ -556,33 +554,19 @@ fifo_close(ap) if (fip->fi_writers == 0) socantrcvmore(fip->fi_readsock); } - VOP_UNLOCK(vp, 0, td); - return (0); -} - -static int -fifo_inactive(ap) - struct vop_inactive_args /* { - struct vnode *a_vp; - struct thread *a_td; - } */ *ap; -{ - struct vnode *vp = ap->a_vp; - struct fifoinfo *fip = vp->v_fifoinfo; - VI_LOCK(vp); - if (fip != NULL && vp->v_usecount == 0) { + if (vp->v_usecount == 1) { vp->v_fifoinfo = NULL; VI_UNLOCK(vp); (void)soclose(fip->fi_readsock); (void)soclose(fip->fi_writesock); FREE(fip, M_VNODE); - } - VOP_UNLOCK(vp, 0, ap->a_td); + } else + VI_UNLOCK(vp); + VOP_UNLOCK(vp, 0, td); return (0); } - /* * Print out internal contents of a fifo vnode. */ |