From: Trond Myklebust <trondmy@hammerspace.com>
To: "anna.schumaker@netapp.com" <anna.schumaker@netapp.com>,
"olga.kornievskaia@gmail.com" <olga.kornievskaia@gmail.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/1] NFSv4.1 fix incorrect return value in copy_file_range
Date: Thu, 11 Apr 2019 16:46:51 +0000 [thread overview]
Message-ID: <0de6cbcd86a69d2e19e4adc2cd70822ce0ae557a.camel@hammerspace.com> (raw)
In-Reply-To: <20190411162747.4360-1-olga.kornievskaia@gmail.com>
On Thu, 2019-04-11 at 12:27 -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@netapp.com>
>
> When VFS calls copy_file_range on a 4.0 mount (and when in and out
> file is the same), we need to return ENOTSUPP instead of EINVAL.
> Since no COPY operation is defined in 4.0, then like 3.0, it should
> fallback to doing do_splice_direct().
>
> Otherwise xfstest generic/075,091,112,263 fail.
>
> Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
> ---
> fs/nfs/nfs4file.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/fs/nfs/nfs4file.c b/fs/nfs/nfs4file.c
> index 45b2322..9a222b0 100644
> --- a/fs/nfs/nfs4file.c
> +++ b/fs/nfs/nfs4file.c
> @@ -133,6 +133,12 @@ static ssize_t nfs4_copy_file_range(struct file
> *file_in, loff_t pos_in,
> struct file *file_out, loff_t
> pos_out,
> size_t count, unsigned int flags)
> {
> + struct nfs_server *server = NFS_SERVER(file_inode(file_in);
> + struct nfs_client *client = server->nfs_client;
> +
> + if (client->cl_minorversion < 1)
> + return -EOPNOTSUPP;
> +
> if (file_inode(file_in) == file_inode(file_out))
> return -EINVAL;
> return nfs42_proc_copy(file_in, pos_in, file_out, pos_out,
> count);
Let's please just move the test for NFS_CAP_COPY from nfs42_proc_copy()
into the above function.
BTW: Why do we return -EINVAL in the file_in == file_out case? Is there
any reason why we shouldn't just return EOPNOTSUPP there too in order
to let splice() fulfil the operation?
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2019-04-11 16:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 16:27 [PATCH 1/1] NFSv4.1 fix incorrect return value in copy_file_range Olga Kornievskaia
2019-04-11 16:46 ` Trond Myklebust [this message]
2019-04-11 16:52 ` Olga Kornievskaia
2019-04-11 16:53 ` Olga Kornievskaia
2019-04-11 17:06 ` Trond Myklebust
2019-04-11 17:16 ` Olga Kornievskaia
2019-04-11 17:32 ` Trond Myklebust
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0de6cbcd86a69d2e19e4adc2cd70822ce0ae557a.camel@hammerspace.com \
--to=trondmy@hammerspace.com \
--cc=anna.schumaker@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=olga.kornievskaia@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox