On 10 Nov, Lukas Ertl wrote: > Hi, > > is there a known problem with named pipes in -CURRENT? > > The following shell script freezes a machine in several minutes and needs > a power cycle. You can see the increasing memory in vmstat -z (unpcb) and > netstat -u. The kernel is FreeBSD 5.1-CURRENT Tue Nov 4 14:08:23 CET 2003. > > ---8<--- > #/bin/sh > > FIFO=/tmp/foo > > for i in `jot 50000 1`; do > mkfifo ${FIFO} > echo blubb > ${FIFO} & > kill $! > rm ${FIFO} > done > ---8<--- If fifo_open() is interrupted, fifo_close() never gets called, and the resources are not recovered. I wish doing the resource recovery in fifo_inactive() would have worked ... Try this patch: Index: sys/fs/fifofs/fifo_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/fs/fifofs/fifo_vnops.c,v retrieving revision 1.89 diff -u -r1.89 fifo_vnops.c --- sys/fs/fifofs/fifo_vnops.c 16 Jun 2003 17:17:09 -0000 1.89 +++ sys/fs/fifofs/fifo_vnops.c 10 Nov 2003 19:11:00 -0000 _at__at_ -154,6 +154,26 _at__at_ } /* + * Dispose of fifo resources. + * Should be called with vnode locked + */ +static void +fifo_cleanup(struct vnode *vp) +{ + struct fifoinfo *fip = vp->v_fifoinfo; + + VI_LOCK(vp); + 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); + } else + VI_UNLOCK(vp); +} + +/* * Open called to set up a new instance of a fifo or * to find an active instance of a fifo. */ _at__at_ -249,6 +269,7 _at__at_ fip->fi_readers--; if (fip->fi_readers == 0) socantsendmore(fip->fi_writesock); + fifo_cleanup(vp); return (error); } VI_LOCK(vp); _at__at_ -268,6 +289,7 _at__at_ fip->fi_writers--; if (fip->fi_writers == 0) socantrcvmore(fip->fi_readsock); + fifo_cleanup(vp); return (error); } /* _at__at_ -554,15 +576,7 _at__at_ if (fip->fi_writers == 0) socantrcvmore(fip->fi_readsock); } - VI_LOCK(vp); - 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); - } else - VI_UNLOCK(vp); + fifo_cleanup(vp); VOP_UNLOCK(vp, 0, td); return (0); }Received on Mon Nov 10 2003 - 10:57:37 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:28 UTC