From patchwork Thu Mar 2 16:01:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 9600737 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5116460429 for ; Thu, 2 Mar 2017 16:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40AD028562 for ; Thu, 2 Mar 2017 16:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3573C285B6; Thu, 2 Mar 2017 16:03:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D87CF28562 for ; Thu, 2 Mar 2017 16:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751745AbdCBQD1 (ORCPT ); Thu, 2 Mar 2017 11:03:27 -0500 Received: from mx141.netapp.com ([216.240.21.12]:17448 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754713AbdCBQDU (ORCPT ); Thu, 2 Mar 2017 11:03:20 -0500 X-IronPort-AV: E=Sophos;i="5.35,232,1484035200"; d="scan'208";a="186941932" Received: from vmwexchts02-prd.hq.netapp.com ([10.122.105.23]) by mx141-out.netapp.com with ESMTP; 02 Mar 2017 07:52:47 -0800 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS02-PRD.hq.netapp.com (10.122.105.23) with Microsoft SMTP Server id 15.0.1210.3; Thu, 2 Mar 2017 08:01:21 -0800 Received: from localhost.localdomain ([10.63.239.5]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id v22G1KHT017525; Thu, 2 Mar 2017 08:01:22 -0800 (PST) From: Olga Kornievskaia To: CC: Subject: [RFC v1 02/19] VFS permit cross device vfs_copy_file_range Date: Thu, 2 Mar 2017 11:01:06 -0500 Message-ID: <20170302160123.30375-3-kolga@netapp.com> X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20170302160123.30375-1-kolga@netapp.com> References: <20170302160123.30375-1-kolga@netapp.com> MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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; }