summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_descrip.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-06-09 18:50:32 +0000
committerpjd <pjd@FreeBSD.org>2012-06-09 18:50:32 +0000
commit0311d1f4cc0be72cf22862e3b1d6f02c40030dae (patch)
tree50faa1e07395e1c84c49c464b660cee6b7c65a74 /sys/kern/kern_descrip.c
parent468d011a0d791a06abe4ff6e3ce9539e05e20e3b (diff)
downloadFreeBSD-src-0311d1f4cc0be72cf22862e3b1d6f02c40030dae.zip
FreeBSD-src-0311d1f4cc0be72cf22862e3b1d6f02c40030dae.tar.gz
There is no need to drop the FILEDESC lock around malloc(M_WAITOK) anymore, as
we now use sx lock for filedesc structure protection. Reviewed by: kib MFC after: 1 month
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r--sys/kern/kern_descrip.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 404d385..3a5b318 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1428,9 +1428,7 @@ out:
}
/*
- * Grow the file table to accomodate (at least) nfd descriptors. This may
- * block and drop the filedesc lock, but it will reacquire it before
- * returning.
+ * Grow the file table to accomodate (at least) nfd descriptors.
*/
static void
fdgrowtable(struct filedesc *fdp, int nfd)
@@ -1456,7 +1454,6 @@ fdgrowtable(struct filedesc *fdp, int nfd)
return;
/* allocate a new table and (if required) new bitmaps */
- FILEDESC_XUNLOCK(fdp);
ntable = malloc((nnfiles * OFILESIZE) + sizeof(struct freetable),
M_FILEDESC, M_ZERO | M_WAITOK);
nfileflags = (char *)&ntable[nnfiles];
@@ -1465,20 +1462,7 @@ fdgrowtable(struct filedesc *fdp, int nfd)
M_FILEDESC, M_ZERO | M_WAITOK);
else
nmap = NULL;
- FILEDESC_XLOCK(fdp);
- /*
- * We now have new tables ready to go. Since we dropped the
- * filedesc lock to call malloc(), watch out for a race.
- */
- onfiles = fdp->fd_nfiles;
- if (onfiles >= nnfiles) {
- /* we lost the race, but that's OK */
- free(ntable, M_FILEDESC);
- if (nmap != NULL)
- free(nmap, M_FILEDESC);
- return;
- }
bcopy(fdp->fd_ofiles, ntable, onfiles * sizeof(*ntable));
bcopy(fdp->fd_ofileflags, nfileflags, onfiles);
otable = fdp->fd_ofiles;
OpenPOWER on IntegriCloud