summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-26 20:41:16 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-21 07:17:01 +0200
commit60f0d449601d7c4c375ffd3083b4c65f0950288c (patch)
tree9bdb0bf8601e283e171ec22b738074452a427c46 /fs
parent6075729f76dafd55d72c2ca8a0a7f381a03e259e (diff)
downloadlinux-stable-60f0d449601d7c4c375ffd3083b4c65f0950288c.tar.gz
linux-stable-60f0d449601d7c4c375ffd3083b4c65f0950288c.tar.bz2
linux-stable-60f0d449601d7c4c375ffd3083b4c65f0950288c.zip
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')
-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 e0c257bd62b9..89fa9c706b38 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;