From owner-svn-src-all@FreeBSD.ORG Sun Nov 2 14:12:03 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DACE6CDB; Sun, 2 Nov 2014 14:12:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C76A3A2A; Sun, 2 Nov 2014 14:12:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sA2EC3l7033921; Sun, 2 Nov 2014 14:12:03 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sA2EC3Hl033920; Sun, 2 Nov 2014 14:12:03 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201411021412.sA2EC3Hl033920@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 2 Nov 2014 14:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273970 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2014 14:12:04 -0000 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)