linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <andros@netapp.com>
To: <Trond.Myklebust@primarydata.com>
Cc: <Anna.Schumaker@netapp.com>, <bfields@fieldses.org>,
	<linux-nfs@vger.kernel.org>, Andy Adamson <andros@netapp.com>
Subject: [PATCH 03/16] VFS SQUASH use file_out instead of file_in for copy_file_range
Date: Mon, 31 Aug 2015 15:49:53 -0400	[thread overview]
Message-ID: <1441050606-40897-4-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1441050606-40897-1-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Calling file_in->copy_file_range file operations function will not work for
NFS inter-server to server COPY. In the intra-ssc case, when the destination
server calls vfs_copy_file_range (from nfsd_copy_range) to perform the
copy offload, it uses an NFS client file_in struct file setup to let the
destination server (acting as an NFS client) NFS READ the data to be copied
from the source server. Using the NFS file_in thus results in calling
the NFS client copy_file_range f-ops, nfs4_copy_file_range, which results in
the destination server trying to start a new COPY (calling COPY_NOTIFY etc)
causing a circular call mess.

Instead, vfs_copy_file_range should use the file_out f_ops->copy_file_range
proceedure if it has one.  The vfs_copy_file_range is a destination based
operation as the source is simply being read, while the destination is being
written and can therefore utilize a copy_file_range call if provided.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/read_write.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/read_write.c b/fs/read_write.c
index da28205..2a4b7bd 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1395,8 +1395,8 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
 		return ret;
 
 	ret = -ENOTSUPP;
-	if (file_in->f_op->copy_file_range)
-		ret = file_in->f_op->copy_file_range(file_in, pos_in, file_out,
+	if (file_out->f_op->copy_file_range)
+		ret = file_out->f_op->copy_file_range(file_in, pos_in, file_out,
 						     pos_out, len, flags);
 	if (ret == -ENOTSUPP)
 		ret = do_splice_direct(file_in, &pos_in, file_out, &pos_out, len, flags);
-- 
1.8.3.1


  parent reply	other threads:[~2015-08-31 19:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31 19:49 [PATCH 00/16] NFSv4.2: Add support for inter-server to server COPY andros
2015-08-31 19:49 ` [PATCH 01/16] VFS: Separate cross fs check from vfs_copy_file_range andros
2015-08-31 19:49 ` [PATCH 02/16] BTRFS: Use VFS copy offload helper andros
2015-08-31 19:49 ` andros [this message]
2015-08-31 19:49 ` [PATCH 04/16] NFS COPY xdr changes andros
2015-08-31 19:49 ` [PATCH 05/16] NFS add same file check and flush source and destination for COPY andros
2015-08-31 19:49 ` [PATCH 06/16] NFS add inter ssc functions to nfs42proc andros
2015-08-31 19:49 ` [PATCH 07/16] NFS add COPY_NOTIFY operation andros
2015-08-31 19:49 ` [PATCH 08/16] NFSD add ca_source_server<> to COPY andros
2015-08-31 19:49 ` [PATCH 09/16] NFSD add COPY_NOTIFY operation andros
2015-08-31 19:50 ` [PATCH 10/16] NFS add ca_source_server<> to COPY andros
2015-08-31 19:50 ` [PATCH 11/16] NFSD generalize nfsd4_compound_state flag names andros
2015-08-31 19:50 ` [PATCH 12/16] NFSD: allow inter server COPY to have a STALE source server fh andros
2015-08-31 19:50 ` [PATCH 13/16] NFSD add nfs4 inter ssc to nfsd4_copy andros
2015-08-31 19:50 ` [PATCH 14/16] NFS in copy use stateid returned by copy_notify andros
2015-08-31 19:50 ` [PATCH 15/16] NFS always use openstateid in COPY_NOTIFY andros
2015-08-31 19:50 ` [PATCH 16/16] NFSD: extra stateid checking in read for interserver copy andros

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=1441050606-40897-4-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=Anna.Schumaker@netapp.com \
    --cc=Trond.Myklebust@primarydata.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).