svn commit: r273956 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Sun Nov 2 01:13:12 UTC 2014


Author: mjg
Date: Sun Nov  2 01:13:11 2014
New Revision: 273956
URL: https://svnweb.freebsd.org/changeset/base/273956

Log:
  filedesc: lock filedesc lock in fdcloseexec only when needed

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Sun Nov  2 00:11:25 2014	(r273955)
+++ head/sys/kern/kern_descrip.c	Sun Nov  2 01:13:11 2014	(r273956)
@@ -2160,19 +2160,17 @@ fdcloseexec(struct thread *td)
 
 	fdp = td->td_proc->p_fd;
 	KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared"));
-	FILEDESC_XLOCK(fdp);
 	for (i = 0; i <= fdp->fd_lastfile; i++) {
 		fde = &fdp->fd_ofiles[i];
 		fp = fde->fde_file;
 		if (fp != NULL && (fp->f_type == DTYPE_MQUEUE ||
 		    (fde->fde_flags & UF_EXCLOSE))) {
+			FILEDESC_XLOCK(fdp);
 			fdfree(fdp, i);
 			(void) closefp(fdp, i, fp, td, 0);
 			/* closefp() drops the FILEDESC lock. */
-			FILEDESC_XLOCK(fdp);
 		}
 	}
-	FILEDESC_XUNLOCK(fdp);
 }
 
 /*


More information about the svn-src-head mailing list