]> asedeno.scripts.mit.edu Git - linux.git/commit
nfsd: fix nfs read eof detection
authorTrond Myklebust <trondmy@gmail.com>
Mon, 26 Aug 2019 17:03:11 +0000 (13:03 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 23 Sep 2019 20:24:08 +0000 (16:24 -0400)
commit83a63072c815e8a042c60fa964dcbde2a6df0e87
tree2c768fecd75e144e5faf38951c96dd73d91e181e
parent65643f4c8217edb1f40f7fb05f996c3a4798442a
nfsd: fix nfs read eof detection

Currently, the knfsd server assumes that a short read indicates an
end of file. That assumption is incorrect. The short read means that
either we've hit the end of file, or we've hit a read error.

In the case of a read error, the client may want to retry (as per the
implementation recommendations in RFC1813 and RFC7530), but currently it
is being told that it hit an eof.

Move the code to detect eof from version specific code into the generic
nfsd read.

Report eof only in the two following cases:
1) read() returns a zero length short read with no error.
2) the offset+length of the read is >= the file size.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs3proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/nfsproc.c
fs/nfsd/vfs.c
fs/nfsd/vfs.h
fs/nfsd/xdr3.h