Author: kib
Date: Wed Jan 19 12:19:25 2011
New Revision: 217578
URL: http://svn.freebsd.org/changeset/base/217578

Log:
  In linuxolator getdents_common(), it seems there is no reason to loop
  if no records where returned by VOP_READDIR(). Readdir implementations
  allowed to return 0 records when first record is larger then supplied
  buffer. In this case trying to execute VOP_READDIR() again causes the
  syscall looping forewer.
  
  The goto was there from the day 1, which goes back to 1995 year.
  
  Reported and tested by:       Beat G?tzi <beat chruetertee ch>
  MFC after:   2 weeks

Modified:
  head/sys/compat/linux/linux_file.c

Modified: head/sys/compat/linux/linux_file.c
==============================================================================
--- head/sys/compat/linux/linux_file.c  Wed Jan 19 10:30:49 2011        
(r217577)
+++ head/sys/compat/linux/linux_file.c  Wed Jan 19 12:19:25 2011        
(r217578)
@@ -369,7 +369,6 @@ getdents_common(struct thread *td, struc
        lbuf = malloc(LINUX_MAXRECLEN, M_TEMP, M_WAITOK | M_ZERO);
        vn_lock(vp, LK_SHARED | LK_RETRY);
 
-again:
        aiov.iov_base = buf;
        aiov.iov_len = buflen;
        auio.uio_iov = &aiov;
@@ -506,8 +505,10 @@ again:
                        break;
        }
 
-       if (outp == (caddr_t)args->dirent)
-               goto again;
+       if (outp == (caddr_t)args->dirent) {
+               nbytes = resid;
+               goto eof;
+       }
 
        fp->f_offset = off;
        if (justone)
_______________________________________________
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