linux/fs/nfsd
Doug Nazar b726e923ea Fix nfsd truncation of readdir results
Commit 8d7c4203 "nfsd: fix failure to set eof in readdir in some
situations" introduced a bug: on a directory in an exported ext3
filesystem with dir_index unset, a READDIR will only return about 250
entries, even if the directory was larger.

Bisected it back to this commit; reverting it fixes the problem.

It turns out that in this case ext3 reads a block at a time, then
returns from readdir, which means we can end up with buf.full==0 but
with more entries in the directory still to be read.  Before 8d7c4203
(but after c002a6c797 "Optimise NFS readdir hack slightly"), this would
cause us to return the READDIR result immediately, but with the eof bit
unset.  That could cause a performance regression (because the client
would need more roundtrips to the server to read the whole directory),
but no loss in correctness, since the cleared eof bit caused the client
to send another readdir.  After 8d7c4203, the setting of the eof bit
made this a correctness problem.

So, move nfserr_eof into the loop and remove the buf.full check so that
we loop until buf.used==0.  The following seems to do the right thing
and reduces the network traffic since we don't return a READDIR result
until the buffer is full.

Tested on an empty directory & large directory; eof is properly sent and
there are no more short buffers.

Signed-off-by: Doug Nazar <nazard@dragoninc.ca>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
2008-11-09 15:15:50 -05:00
..
Makefile knfsd: trivial makefile cleanup 2007-05-09 12:30:54 -07:00
auth.c nfsd: fix sparse warnings 2008-04-23 16:13:39 -04:00
auth.h nfsd: minor fs/nfsd/auth.h cleanup 2008-02-01 16:42:05 -05:00
export.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6 2008-10-23 10:22:40 -07:00
lockd.c nfsd: common grace period control 2008-10-03 16:19:02 -04:00
nfs2acl.c nfsd: rename MAY_ flags 2008-06-23 13:02:50 -04:00
nfs3acl.c nfsd: rename MAY_ flags 2008-06-23 13:02:50 -04:00
nfs3proc.c nfsd: permit unauthenticated stat of export root 2008-09-29 17:56:56 -04:00
nfs3xdr.c Use struct path in struct svc_export 2008-02-14 21:17:08 -08:00
nfs4acl.c nfsd: fix buffer overrun decoding NFSv4 acl 2008-09-01 14:24:24 -04:00
nfs4callback.c nfsd: use nfs client rpc callback program 2008-09-29 18:13:40 -04:00
nfs4idmap.c nfsd: fix sparse warnings 2008-04-23 16:13:39 -04:00
nfs4proc.c nfsd: common grace period control 2008-10-03 16:19:02 -04:00
nfs4recover.c [PATCH] switch nfsd to kern_path() 2008-10-23 05:12:51 -04:00
nfs4state.c [PATCH] switch nfsd to kern_path() 2008-10-23 05:12:51 -04:00
nfs4xdr.c nfsd: nfs4xdr decode_stateid helper function 2008-09-29 17:56:59 -04:00
nfscache.c nfsd: fail module init on reply cache init failure 2008-02-01 16:42:04 -05:00
nfsctl.c [PATCH] switch nfsd to kern_path() 2008-10-23 05:12:51 -04:00
nfsfh.c nfsd: permit unauthenticated stat of export root 2008-09-29 17:56:56 -04:00
nfsproc.c nfsd: permit unauthenticated stat of export root 2008-09-29 17:56:56 -04:00
nfssvc.c NFSD: Fix BUG during NFSD shutdown processing 2008-10-22 13:36:05 -04:00
nfsxdr.c Use struct path in struct svc_export 2008-02-14 21:17:08 -08:00
stats.c [PATCH] knfsd: nfsd4: add per-operation server stats 2006-07-10 13:24:27 -07:00
vfs.c Fix nfsd truncation of readdir results 2008-11-09 15:15:50 -05:00