Author: pjd
Date: Mon Jun 11 19:48:55 2012
New Revision: 236910
URL: http://svn.freebsd.org/changeset/base/236910

Log:
  Now that fdgrowtable() doesn't drop the filedesc lock we don't need to
  check if descriptor changed from under us. Replace the check with an
  assert.
  
  Discussed with:       kib
  Tested by:    pho
  MFC after:    1 month

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==============================================================================
--- head/sys/kern/kern_descrip.c        Mon Jun 11 19:20:59 2012        
(r236909)
+++ head/sys/kern/kern_descrip.c        Mon Jun 11 19:48:55 2012        
(r236910)
@@ -871,19 +871,7 @@ do_dup(struct thread *td, int flags, int
                }
        }
 
-       /*
-        * If the old file changed out from under us then treat it as a
-        * bad file descriptor.  Userland should do its own locking to
-        * avoid this case.
-        */
-       if (fdp->fd_ofiles[old] != fp) {
-               /* we've allocated a descriptor which we won't use */
-               if (fdp->fd_ofiles[new] == NULL)
-                       fdunused(fdp, new);
-               FILEDESC_XUNLOCK(fdp);
-               fdrop(fp, td);
-               return (EBADF);
-       }
+       KASSERT(fp == fdp->fd_ofiles[old], ("old fd has been modified"));
        KASSERT(old != new, ("new fd is same as old"));
 
        /*
_______________________________________________
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