summaryrefslogtreecommitdiffstats
path: root/fs/nfs/proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-27 02:41:16 +0200
committerTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-27 16:24:56 +0200
commit71affe9be45a5c60b9772e1b2701710712637274 (patch)
tree482ce7d426e1cfaef2a8c1c9c09b8d4de9f9a59b /fs/nfs/proc.c
parentNFS: Fix writepage(s) error handling to not report errors twice (diff)
downloadlinux-71affe9be45a5c60b9772e1b2701710712637274.tar.xz
linux-71affe9be45a5c60b9772e1b2701710712637274.zip
NFSv2: Fix eof handling
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>
Diffstat (limited to '')
-rw-r--r--fs/nfs/proc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
index 5552fa8b6e12..ec79d2214a78 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
@@ -594,7 +594,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;