Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jun 2012 10:25:12 +0000 (UTC)
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r236950 - head/sys/kern
Message-ID:  <201206121025.q5CAPCXE044654@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pjd
Date: Tue Jun 12 10:25:11 2012
New Revision: 236950
URL: http://svn.freebsd.org/changeset/base/236950

Log:
  Revert part of the r236935 for now, until I figure out why it doesn't
  work properly.
  
  Reported by:	davidxu

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c	Tue Jun 12 09:18:28 2012	(r236949)
+++ head/sys/kern/kern_descrip.c	Tue Jun 12 10:25:11 2012	(r236950)
@@ -1480,10 +1480,12 @@ fdalloc(struct thread *td, int minfd, in
 	 * to grow the file table.  Keep at it until we either get a file
 	 * descriptor or run into process or system limits.
 	 */
-	fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
-	if (fd >= maxfd)
-		return (EMFILE);
-	if (fd >= fdp->fd_nfiles) {
+	for (;;) {
+		fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
+		if (fd >= maxfd)
+			return (EMFILE);
+		if (fd < fdp->fd_nfiles)
+			break;
 #ifdef RACCT
 		PROC_LOCK(p);
 		error = racct_set(p, RACCT_NOFILE,
@@ -1493,10 +1495,6 @@ fdalloc(struct thread *td, int minfd, in
 			return (EMFILE);
 #endif
 		fdgrowtable(fdp, min(fdp->fd_nfiles * 2, maxfd));
-		/* Retry... */
-		fd = fd_first_free(fdp, minfd, fdp->fd_nfiles);
-		if (fd >= maxfd)
-			return (EMFILE);
 	}
 
 	/*



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