NFSv4.1 fix incorrect return value in copy_file_range
authorOlga Kornievskaia <kolga@netapp.com>
Thu, 11 Apr 2019 18:34:18 +0000 (14:34 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 11 Apr 2019 19:23:48 +0000 (15:23 -0400)
commit0769663b4f580566ef6cdf366f3073dbe8022c39
tree96eb99500c11d736c336f960b3e12bbdeb132e51
parente1ede312f17e96a9c5cda9aaa1cdcf442c1a5da8
NFSv4.1 fix incorrect return value in copy_file_range

According to the NFSv4.2 spec if the input and output file is the
same file, operation should fail with EINVAL. However, linux
copy_file_range() system call has no such restrictions. Therefore,
in such case let's return EOPNOTSUPP and allow VFS to fallback
to doing do_splice_direct(). Also when copy_file_range is called
on an NFSv4.0 or 4.1 mount (ie., a server that doesn't support
COPY functionality), we also need to return EOPNOTSUPP and
fallback to a regular copy.

Fixes xfstest generic/075, generic/091, generic/112, generic/263
for all NFSv4.x versions.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs42proc.c
fs/nfs/nfs4file.c