Skip to content

Commit 6533681

Browse files
Trond Myklebustgregkh
authored andcommitted
nfsd: Don't set eof on a truncated READ_PLUS
[ Upstream commit b68f0cb ] If the READ_PLUS operation was truncated due to an error, then ensure we clear the 'eof' flag. Fixes: 9f0b579 ("NFSD: Encode a full READ_PLUS reply") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent de82ec8 commit 6533681

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4736,14 +4736,15 @@ nfsd4_encode_read_plus(struct nfsd4_compoundres *resp, __be32 nfserr,
47364736
if (nfserr && segments == 0)
47374737
xdr_truncate_encode(xdr, starting_len);
47384738
else {
4739-
tmp = htonl(eof);
4740-
write_bytes_to_xdr_buf(xdr->buf, starting_len, &tmp, 4);
4741-
tmp = htonl(segments);
4742-
write_bytes_to_xdr_buf(xdr->buf, starting_len + 4, &tmp, 4);
47434739
if (nfserr) {
47444740
xdr_truncate_encode(xdr, last_segment);
47454741
nfserr = nfs_ok;
4742+
eof = 0;
47464743
}
4744+
tmp = htonl(eof);
4745+
write_bytes_to_xdr_buf(xdr->buf, starting_len, &tmp, 4);
4746+
tmp = htonl(segments);
4747+
write_bytes_to_xdr_buf(xdr->buf, starting_len + 4, &tmp, 4);
47474748
}
47484749

47494750
return nfserr;

0 commit comments

Comments
 (0)