nfsd: COPY with length 0 should copy to end of file

[ Upstream commit 792a5112aa90e59c048b601c6382fe3498d75db7 ]

>From https://tools.ietf.org/html/rfc7862#page-65

	A count of 0 (zero) requests that all bytes from ca_src_offset
	through EOF be copied to the destination.

Reported-by: <radchenkoy@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
J. Bruce Fields
2021-03-18 20:03:23 -04:00
committed by Greg Kroah-Hartman
parent ed01819390
commit 1f76b1e659

View File

@@ -1380,6 +1380,9 @@ static ssize_t _nfsd_copy_file_range(struct nfsd4_copy *copy)
u64 src_pos = copy->cp_src_pos;
u64 dst_pos = copy->cp_dst_pos;
/* See RFC 7862 p.67: */
if (bytes_total == 0)
bytes_total = ULLONG_MAX;
do {
if (kthread_should_stop())
break;