From patchwork Fri Sep 4 17:29:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Adamson X-Patchwork-Id: 7125141 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0F1CFBEEC1 for ; Fri, 4 Sep 2015 17:30:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A43D20768 for ; Fri, 4 Sep 2015 17:30:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B1FD208AB for ; Fri, 4 Sep 2015 17:30:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932788AbbIDR35 (ORCPT ); Fri, 4 Sep 2015 13:29:57 -0400 Received: from mx141.netapp.com ([216.240.21.12]:19310 "EHLO mx141.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932689AbbIDR35 (ORCPT ); Fri, 4 Sep 2015 13:29:57 -0400 X-IronPort-AV: E=Sophos;i="5.17,470,1437462000"; d="scan'208";a="67185470" Received: from vmwexchts01-prd.hq.netapp.com ([10.122.105.12]) by mx141-out.netapp.com with ESMTP; 04 Sep 2015 10:29:57 -0700 Received: from smtp2.corp.netapp.com (10.57.159.114) by VMWEXCHTS01-PRD.hq.netapp.com (10.122.105.12) with Microsoft SMTP Server id 15.0.1076.9; Fri, 4 Sep 2015 10:29:56 -0700 Received: from rhel7-1-snap3.localdomain (dros-16.vpn.netapp.com [10.55.64.65]) by smtp2.corp.netapp.com (8.13.1/8.13.1/NTAP-1.6) with ESMTP id t84HTqKL021957; Fri, 4 Sep 2015 10:29:55 -0700 (PDT) From: To: CC: , , , Andy Adamson Subject: [PATCH Version 2 03/16] VFS SQUASH use file_out instead of file_in for copy_file_range Date: Fri, 4 Sep 2015 13:29:25 -0400 Message-ID: <1441387778-16465-4-git-send-email-andros@netapp.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1441387778-16465-1-git-send-email-andros@netapp.com> References: <1441387778-16465-1-git-send-email-andros@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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andy Adamson 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 --- 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);