2019-08-26 17:12:55

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH 0/1] Clean up and fix NFS server handling of eof

Currently, the knfsd server assumes that a short read indicates and
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.

The following patch cleans up read, and fixes the eof reporting
to 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.

Trond Myklebust (1):
nfsd: Clean up nfs read eof detection

fs/nfsd/nfs3proc.c | 9 ++-------
fs/nfsd/nfs4xdr.c | 11 +++--------
fs/nfsd/nfsproc.c | 4 +++-
fs/nfsd/vfs.c | 37 ++++++++++++++++++++++++++-----------
fs/nfsd/vfs.h | 28 ++++++----------------------
fs/nfsd/xdr3.h | 2 +-
6 files changed, 41 insertions(+), 50 deletions(-)

--
2.21.0


2019-09-25 23:42:57

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [PATCH 0/1] Clean up and fix NFS server handling of eof

Thanks, applying!

But I like your explanation better than your explanation on the
patch--copying it into the changelog.

--b

On Mon, Aug 26, 2019 at 01:03:10PM -0400, Trond Myklebust wrote:
> Currently, the knfsd server assumes that a short read indicates and
> 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.
>
> The following patch cleans up read, and fixes the eof reporting
> to 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.
>
> Trond Myklebust (1):
> nfsd: Clean up nfs read eof detection
>
> fs/nfsd/nfs3proc.c | 9 ++-------
> fs/nfsd/nfs4xdr.c | 11 +++--------
> fs/nfsd/nfsproc.c | 4 +++-
> fs/nfsd/vfs.c | 37 ++++++++++++++++++++++++++-----------
> fs/nfsd/vfs.h | 28 ++++++----------------------
> fs/nfsd/xdr3.h | 2 +-
> 6 files changed, 41 insertions(+), 50 deletions(-)
>
> --
> 2.21.0