Just use 'fdrop()' instead of 'FILE_LOCK(); fdrop_locked()' in

dupfdopen().  While I'm at it, move the second fdrop() out from under the
filedesc lock.
This commit is contained in:
John Baldwin 2007-03-15 21:19:21 +00:00
parent e9c804063f
commit 3076ca6720
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167621

View file

@ -2296,14 +2296,12 @@ dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd, int mode,
fhold_locked(wfp);
FILE_UNLOCK(wfp);
FILEDESC_UNLOCK(fdp);
if (fp != NULL) {
if (fp != NULL)
/*
* We now own the reference to fp that the ofiles[]
* array used to own. Release it.
*/
FILE_LOCK(fp);
fdrop_locked(fp, td);
}
fdrop(fp, td);
return (0);
case ENXIO:
@ -2318,18 +2316,14 @@ dupfdopen(struct thread *td, struct filedesc *fdp, int indx, int dfd, int mode,
fdunused(fdp, dfd);
if (fp == NULL)
fdused(fdp, indx);
if (fp != NULL)
FILE_LOCK(fp);
FILEDESC_UNLOCK(fdp);
/*
* We now own the reference to fp that the ofiles[] array
* used to own. Release it.
*/
if (fp != NULL)
fdrop_locked(fp, td);
FILEDESC_UNLOCK(fdp);
fdrop(fp, td);
return (0);
default: