[PATCH 2/3] xfs: truncate readdir offsets to signed 32 bit values

Dave Chinner david at fromorbit.com
Thu Jan 8 16:43:50 CST 2009


On Thu, Jan 08, 2009 at 02:00:00PM -0500, Christoph Hellwig wrote:
> On Thu, Jan 08, 2009 at 01:42:24PM -0500, Christoph Hellwig wrote:
> > John Stanley reported EOVERFLOW errors in readdir from his self-build
> > glibc.  I traced this down to glibc enabling d_off overflow checks
> > in one of the about five million different getdents implementations.
> > 
> > In 2.6.28 Dave Woodhouse moved our readdir double buffering required
> > for NFS4 readdirplus into nfsd and at that point we lost the capping
> > of the directory offsets to 32 bit signed values.  Johns glibc used
> > getdents64 to even implement readdir for normal 32 bit offset dirents,
> > and failed with EOVERFLOW only if this happens on the first dirent in
> > a getdents call.  I managed to come up with a testcase that uses
> > raw getdents and does the EOVERFLOW check manually.  We always hit
> > it with our last entry due to the special end of directory marker.
> > 
> > The patch below is a dumb version of just putting back the masking,
> > to make sure we have the same behavior as in 2.6.27 and earlier.
> > 
> > I will work on a better and cleaner fix for 2.6.30.
> > 
> > Reported-by: John Stanley <jpsinthemix at verizon.net>
> > Tested-by: John Stanley <jpsinthemix at verizon.net>
> > Signed-off-by: Christoph Hellwig <hch at lst.de>
> 
> As arkem noticed I should not have sent out some half-mangled version
> but the first crude patch.  Here it is:

Reviewed-by: Dave Chinner <david at fromorbit.com>

-- 
Dave Chinner
david at fromorbit.com




More information about the xfs mailing list