Skip to content

Commit

Permalink
NFSv2: Fix eof handling
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trond Myklebust committed Aug 27, 2019
1 parent 96c4145 commit 71affe9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/nfs/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 71affe9

Please sign in to comment.