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);
        }
 
        /*
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to