Date: Sun, 2 Nov 2014 14:12:03 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273970 - head/sys/kern Message-ID: <201411021412.sA2EC3Hl033920@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Sun Nov 2 14:12:03 2014 New Revision: 273970 URL: https://svnweb.freebsd.org/changeset/base/273970 Log: filedesc: move freeing old tables to fdescfree They cannot be accessed by anyone and hold count only protects the structure from being freed. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sun Nov 2 14:08:54 2014 (r273969) +++ head/sys/kern/kern_descrip.c Sun Nov 2 14:12:03 2014 (r273970) @@ -1856,8 +1856,6 @@ fdhold(struct proc *p) static void fddrop(struct filedesc *fdp) { - struct filedesc0 *fdp0; - struct freetable *ft; int i; mtx_lock(&fdesc_mtx); @@ -1867,11 +1865,6 @@ fddrop(struct filedesc *fdp) return; FILEDESC_LOCK_DESTROY(fdp); - fdp0 = (struct filedesc0 *)fdp; - while ((ft = SLIST_FIRST(&fdp0->fd_free)) != NULL) { - SLIST_REMOVE_HEAD(&fdp0->fd_free, ft_next); - free(ft->ft_table, M_FILEDESC); - } free(fdp, M_FILEDESC); } @@ -2032,7 +2025,9 @@ retry: void fdescfree(struct thread *td) { + struct filedesc0 *fdp0; struct filedesc *fdp; + struct freetable *ft; struct filedescent *fde; struct file *fp; struct vnode *cdir, *jdir, *rdir; @@ -2085,6 +2080,12 @@ fdescfree(struct thread *td) if (fdp->fd_nfiles > NDFILE) free(fdp->fd_files, M_FILEDESC); + fdp0 = (struct filedesc0 *)fdp; + while ((ft = SLIST_FIRST(&fdp0->fd_free)) != NULL) { + SLIST_REMOVE_HEAD(&fdp0->fd_free, ft_next); + free(ft->ft_table, M_FILEDESC); + } + if (cdir != NULL) vrele(cdir); if (rdir != NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411021412.sA2EC3Hl033920>