]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commita36adee8c1184b8230c494645758d2e35e32c4aa
treeb6841dd1845a65d17cbdd35d298008d5bd6ae52c
parent84a70bf7feff33a6dad8dd9374be3ebe37b20ac8
NFSv4.1 fix incorrect return value in copy_file_range

BugLink: https://bugs.launchpad.net/bugs/1838700
commit 0769663b4f580566ef6cdf366f3073dbe8022c39 upstream.

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>
Cc: Yu Xu <xuyu@linux.alibaba.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/nfs/nfs42proc.c
fs/nfs/nfs4file.c