Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 May 2009 18:42:04 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192461 - head/sys/kern
Message-ID:  <200905201842.n4KIg4Na040230@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905201842.n4KIg4Na040230>