diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2019-08-26 20:41:16 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-21 07:14:16 +0200 |
commit | bc94dcfbc58199158f71547d06dfb003fa3c1e7a (patch) | |
tree | ea29a71c7246785ec0296a443fdddd9f70fcf8f7 /fs/nfs | |
parent | 970b0ee7ceeb92ad6c2970197d584f7ed2bd8ec9 (diff) |
NFSv2: Fix eof handling
[ Upstream commit 71affe9be45a5c60b9772e1b2701710712637274 ]
If we received a reply from the server with a zero length read and
no error, then that implies we are at eof.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/proc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index b7bca8303989..f3e8bcbd29a0 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -588,7 +588,8 @@ static int nfs_read_done(struct rpc_task *task, struct nfs_pgio_header *hdr) /* Emulate the eof flag, which isn't normally needed in NFSv2 * as it is guaranteed to always return the file attributes */ - if (hdr->args.offset + hdr->res.count >= hdr->res.fattr->size) + if ((hdr->res.count == 0 && hdr->args.count > 0) || + hdr->args.offset + hdr->res.count >= hdr->res.fattr->size) hdr->res.eof = 1; } return 0; |