linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olga Kornievskaia <kolga@netapp.com>
To: <linux-fsdevel@vger.kernel.org>
Cc: <hch@lst.de>, <linux-nfs@vger.kernel.org>
Subject: [PATCH v1 2/3] VFS permit cross device vfs_copy_file_range
Date: Thu, 2 Mar 2017 11:02:10 -0500	[thread overview]
Message-ID: <20170302160211.30451-3-kolga@netapp.com> (raw)
In-Reply-To: <20170302160211.30451-1-kolga@netapp.com>

Allow nfs_copy_file_range to copy across devices.
NFSv4.2 inter server to server copy always copies across devices, and
NFSv4.2 intra server to server copy can copy across devices on the same
server.

If a file system's fileoperations copy_file_range operation prohibits
cross-device copies, fall back to do_splice_direct. This is needed for
nfsd_copy_file_range() which is called by the inter server to server
destination server acting as an NFS client, and reading the file from
the source server.

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

diff --git a/fs/read_write.c b/fs/read_write.c
index 1d9e305..75084cd 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1534,10 +1534,6 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
 	    (file_out->f_flags & O_APPEND))
 		return -EBADF;
 
-	/* this could be relaxed once a method supports cross-fs copies */
-	if (inode_in->i_sb != inode_out->i_sb)
-		return -EXDEV;
-
 	if (len == 0)
 		return 0;
 
@@ -1559,7 +1555,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
 	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 != -EOPNOTSUPP)
+		if (ret != -EOPNOTSUPP && ret != -EXDEV)
 			goto done;
 	}
 
-- 
1.8.3.1

  parent reply	other threads:[~2017-03-02 16:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 16:02 [PATCH v1 0/3] VFS changes for NFSv4.2 "inter" server-to-server COPY op Olga Kornievskaia
2017-03-02 16:02 ` [PATCH v1 1/3] fs: Don't copy beyond the end of the file Olga Kornievskaia
2017-03-02 16:58   ` Darrick J. Wong
2017-03-02 18:21     ` Olga Kornievskaia
2017-03-02 18:40       ` Darrick J. Wong
2017-03-07 23:43         ` Christoph Hellwig
2017-03-07 23:46           ` Olga Kornievskaia
2017-03-07 23:50             ` Christoph Hellwig
2017-03-08 15:39               ` Olga Kornievskaia
2017-03-08 15:57                 ` Christoph Hellwig
2017-03-02 16:02 ` Olga Kornievskaia [this message]
2017-03-02 16:07   ` [PATCH v1 2/3] VFS permit cross device vfs_copy_file_range Christoph Hellwig
2017-03-02 16:38     ` Olga Kornievskaia
2017-03-07 20:35       ` Olga Kornievskaia
2017-03-15 18:09       ` J. Bruce Fields
2017-03-21 15:50         ` J. Bruce Fields
     [not found]           ` <56CDE406-AE24-40E4-852C-1C47C5CCD37E@netapp.com>
2017-03-21 19:03             ` J. Bruce Fields
2017-03-22 17:16               ` Olga Kornievskaia
2018-08-31 16:13   ` Florian Weimer
2018-08-31 16:25     ` Olga Kornievskaia
2018-08-31 22:56       ` Steve French
2017-03-02 16:02 ` [PATCH v1 3/3] VFS don't try clone if superblocks are different Olga Kornievskaia

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=20170302160211.30451-3-kolga@netapp.com \
    --to=kolga@netapp.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.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).