svn commit: r273970 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sun Nov 2 14:12:04 UTC 2014
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)
More information about the svn-src-all
mailing list