svn commit: r192461 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Wed May 20 18:42:05 UTC 2009


Author: jhb
Date: Wed May 20 18:42:04 2009
New Revision: 192461
URL: http://svn.freebsd.org/changeset/base/192461

Log:
  Set the umask in a new file descriptor table earlier in fdcopy() to remove
  two lock operations.

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Wed May 20 18:38:43 2009	(r192460)
+++ head/sys/kern/kern_descrip.c	Wed May 20 18:42:04 2009	(r192461)
@@ -1626,17 +1626,15 @@ fdcopy(struct filedesc *fdp)
 				newfdp->fd_freefile = i;
 		}
 	}
+	newfdp->fd_cmask = fdp->fd_cmask;
 	FILEDESC_SUNLOCK(fdp);
 	FILEDESC_XLOCK(newfdp);
 	for (i = 0; i <= newfdp->fd_lastfile; ++i)
 		if (newfdp->fd_ofiles[i] != NULL)
 			fdused(newfdp, i);
-	FILEDESC_XUNLOCK(newfdp);
-	FILEDESC_SLOCK(fdp);
 	if (newfdp->fd_freefile == -1)
 		newfdp->fd_freefile = i;
-	newfdp->fd_cmask = fdp->fd_cmask;
-	FILEDESC_SUNLOCK(fdp);
+	FILEDESC_XUNLOCK(newfdp);
 	return (newfdp);
 }
 


More information about the svn-src-all mailing list