Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jan 2011 12:19:26 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r217578 - head/sys/compat/linux
Message-ID:  <201101191219.p0JCJQq3075715@svn.freebsd.org>

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



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