From patchwork Thu Dec 8 18:49:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schumaker, Anna" X-Patchwork-Id: 9466977 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 DA02D607D8 for ; Thu, 8 Dec 2016 18:49:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDF1F285E2 for ; Thu, 8 Dec 2016 18:49:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2C52285EE; Thu, 8 Dec 2016 18:49:36 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 73554285EF for ; Thu, 8 Dec 2016 18:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932470AbcLHStf (ORCPT ); Thu, 8 Dec 2016 13:49:35 -0500 Received: from mx143.netapp.com ([216.240.21.24]:44939 "EHLO mx143.netapp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932360AbcLHSt3 (ORCPT ); Thu, 8 Dec 2016 13:49:29 -0500 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="161940500" Received: from hioexcmbx02-prd.hq.netapp.com ([10.122.105.35]) by mx143-out.netapp.com with ESMTP; 08 Dec 2016 10:47:20 -0800 Received: from VMWEXCCAS08-PRD.hq.netapp.com (10.122.105.26) by hioexcmbx02-prd.hq.netapp.com (10.122.105.35) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 8 Dec 2016 10:49:29 -0800 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (10.120.60.153) by VMWEXCCAS08-PRD.hq.netapp.com (10.122.105.26) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Thu, 8 Dec 2016 10:49:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netapp.onmicrosoft.com; s=selector1-netapp-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=KJBveTqLYmMMtjS/BlbAkIZCXav1hu/iPSmycJ9zjnA=; b=pd1F0xW6R+2nd3D8yyr2r7+QMmJ7DVs6SC1GXGKyEkh1za9kuZR3SU1ArbGhyvoK0pPeZka2pq2KHycCD98knCRBACPow+wvq8u5pYyDdGE1ZOcsiCF+6OTIRs4zCuawKH6rzl0ySy7JBPrh4WHdc6MmNwsiseZKtBCvgk1DXtA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Anna.Schumaker@netapp.com; Received: from gouda.nowheycreamery.com.nowheycreamery.com (99.9.112.69) by BLUPR0601MB1636.namprd06.prod.outlook.com (10.163.212.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.761.9; Thu, 8 Dec 2016 18:49:27 +0000 From: Anna Schumaker To: CC: , , Subject: [PATCH v4 6/5] xfs_io: Improvements to copy_range return code handling Date: Thu, 8 Dec 2016 13:49:09 -0500 Message-ID: <20161208184909.23321-7-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161208184909.23321-1-Anna.Schumaker@Netapp.com> References: <20161208184909.23321-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 X-Originating-IP: [99.9.112.69] X-ClientProxiedBy: BN3PR04CA0032.namprd04.prod.outlook.com (10.166.70.170) To BLUPR0601MB1636.namprd06.prod.outlook.com (10.163.212.142) X-MS-Office365-Filtering-Correlation-Id: d631a900-1ca4-4c2b-811d-08d41f9aeff9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BLUPR0601MB1636; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 3:Gb816YDhY4E0d+vXm2iMYzg1hnVgSau59UbqCg3nKJFGiqKC2s8tz90I52nziADVVnBr9L3R9u56CEH5FdxjLtcTMDhtFcEubTCM0bgTdV2RVwPHgWgAvcR0DMprcQBipal//5qGVspgBoOYGOg29MEUL/pzH4Q5eQpzt8YZx/L8hQEjthDx3IoiMuRXCqjBTZGI3IGLm0X+XjKsrKh3LrWhoBS8h8xwShxSGiNzuji5rzQEN+1Xhc8BGjEFujc2b7VpT6fx3DlWJex4hYIe9Q== X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 25:a9B4fLadVaguDXzBrXaCNVj5LS8FO9+HquwsMeIZ09dpBYOenhm6tWLFtapZxxGr3IGnD9e63lRmper6WX/ue7iOL49ZEJaXqy6m7r5fpPi+qpCo8+BiwoWJ/x8/abocYUft0WK2HNacIOEiVfs+6OHd0xLg97PM+ONLlTjbROd84o3mT1UWeaejBTzSEJCxYM9uQW82ugfVMMS5cYBheSWW/2MTz+PM8sNyctLkuaH0qyxV86Ci3BH5otlEuoK4ivzBO/QL1C+Z4gzfvYeGUXeVfBaMqKTTRzhw+JZ3Nr7eJkr7vpj7+wDHG41GtF6m6g1hhmtn6VNZuXOhDaQxOg5DzUUy53YYgqXjbEN8qJdoFsthcbAiLFOTPmcFNhffHvzpFruqBw3fE4l1r3sbgvXv4Rd4vrZlP4Vwef3i387hWzYI5qEL0yfnozVYiKHL8ty5ZrUbrxKDQpnzks8FUS5HksSWYw26uM8gK1jD5VLceFpC0LO94PisrAXo9xPOX7cJrL94InLZ4qQwYG8jwsIlJIcCdJi6bA2DyN7jKcAweLNhjl0oKtaZkU3cquFkrUgfNaIcmZf7HLRDBgXpSv2fyiW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microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(6072148); SRVR:BLUPR0601MB1636; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0601MB1636; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 4:j7NpFBKM8606NywynG0KEN003H+l8sANrEAs/hybiq3XxH8l4qX/F10ihsFS84KH0zkbeUyiqMkH2e+HyxA+j78DXxCbARJIKqQa2Y8sgluknIYQyqViWsxv5nYObVbM2rbKrJN8Ts9QAf2hlmggnsxUp5ek9069K7Rb+ECv3w37Ij13dEOikwDP7HxgJWTzORrab23p2j92FEPOBb05DqAOjn87juxMXfatOuSQP0zD7NgfGzxn6nvq5fQ8FSk8Tmb5OlYAG78/QeCaJnQmxM0dbp3O/+TSOTgWAJS2FECLLMR4PUL90LquuO1Nf9/9xqaHZItaguHeREJHJV47NIwRp8r/PyKVdu7DW4Iuh7UbOwe+gNXr6MdM/gfGU06JmPnjH+F1yjMb1/BQXiQgSVlMzYnzcmWgY++mwJHrMKbOcad8cWW3fBzWEfobPTzyxlOjjv45IiJFHv4BMSY+SKV4axHNOFCwKlWO68PFBqYV7ucQG2QttlH3qnoTyJ3bCszsumhzb0DkA0/TF+Vs/B3L7V5Ob9nLULRD2qEQNeAkewWomp9ZQrcf/H5CcnYuJuqhTCjFXKPy/uY5V9fQHtINu531zaimJZgALew5PSo= X-Forefront-PRVS: 0150F3F97D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(39840400002)(39410400002)(39450400003)(39860400002)(39850400002)(189002)(199003)(189998001)(50226002)(50466002)(4326007)(1076002)(48376002)(7846002)(81166006)(81156014)(101416001)(7736002)(92566002)(305945005)(8676002)(68736007)(86362001)(110136003)(106356001)(105586002)(2906002)(47776003)(42186005)(38730400001)(5003940100001)(76176999)(36756003)(733004)(6512006)(5660300001)(6116002)(97736004)(6486002)(2351001)(6916009)(3846002)(6666003)(6506006)(2950100002)(66066001)(50986999); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0601MB1636; H:gouda.nowheycreamery.com.nowheycreamery.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: netapp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0601MB1636; 23:XI1/EmOVdv5/d3foAxhc0rS7NXTYzTc0BXy83OQ?= =?us-ascii?Q?2pIbvb/tieEaeLbM2fbk67RssTEpDeRbpS4NMJSSSySNz01VawwiO8iSSwOy?= =?us-ascii?Q?vUJ8w7CjED7Kcfvr9i7nAYkJ5PLYxqR/TJ317SjWZX4RIFR2dJptjPsO8bFt?= =?us-ascii?Q?pARGcF3UTYAWcvn5CTFDYVl9q5wftH4i+7MFN69qBkBuJSH17T2xnvV9mvH/?= =?us-ascii?Q?qATTVYl+17J9gHiVYbaN2Ly6hhccc4/QqVEeVuo/SbXVOR4XIt0L5Nf90olw?= =?us-ascii?Q?2hbP1cqmBt4PVBQAKyTcAC7iGV3NIu0IjOEYjoeknPljawrCrxSPRvdSbW1+?= =?us-ascii?Q?gCBhUoQ6gxbEbcQrJjFtRM8yMtJlJLCBkfCER7OqiLrpLKu16Wt9Xmbp9UgE?= =?us-ascii?Q?f8vYrUP8uEZ3u9ODTXEjk6xVNE7WYe6+KoQAv2kr7CD4aOR6sl/VeCCfi0Dj?= =?us-ascii?Q?VBuJ4QAhXfXGocfWMOYbFedKGPLAcieQuv2gby3VyXf2bYfTR+yfHSgZzeai?= =?us-ascii?Q?ycdQLII2YN9qAPCaw0oganWpQy9gPnyoIM6KMbOM2y0COt1xV/S+DgZuYMhl?= =?us-ascii?Q?Tb4qMbnsrZ/frESbFg8YQdRj5GFC/KKnTlFHncWfN4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G2zid+YJUdnbj0UrmBnaKB13NMdLkiX61o419aFxvwbQPAPAM2wGxtHOWF1YOSh+rQCLGH8pco1NSOEjRuXdIWh39T7fPQugn9C+x4YUevvLkpH2RNE9GOGGBhzkb/XyX+0qxM=; 5:tPly46d/42LKl+nsjvcZ2Nb0kmJAnAnaAjnTpX3I3QwHtdCp6I0TqkCo21LCmiVws7QoOnmkxqsAgG42W7NnXyNrpo3uKYC+o3zShYAD5VcJ20j1SfHaiOZ2Hii69toVNw0xp8h4BgD6/t6svH5ZSWtNy7hdHM8Zu04BBFljHQE=; 24:JU3DKTxpCt8LqnedpfaHH6OYq4HsJ0S/5RMkhV1EP6bWLYOc9W7oHQPhgLcPgM1lJttFcX3XHZw0+KU9ZF1rLtkjsswqwOPK1k0YidoTxww= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0601MB1636; 7:Rya+L1zp02Lv+FDAWRcafMZD5e2OC3ZaHbB5XqJUpa9CYtHJAjAI1+8DLcbFDI1STBfgpTistjMSZ6pSRhCekpUFw1g4hSr1pSGtdG4hkUkIbZy78wiBxPviiBSVCdFW538qY8wF3L8VHKXVx3LaqIQwJswaJ95ftw9RaNvq7GsLjDRnTmn3shkatmqMaymsW5zXm2K2c/4CRJBkckU2y2oNMnZCrAgMdz1Ns9Yv9SakMcDt4ZjH0TqhRFJQxPEYm/Me4GzwWYgcI7hJqIY+NmRwCivOK+yEF4LATH4ZdBVeEmdK7rUi46RenSQT6ysiE9sGMc8I25/Txf4doNqo3Osswlva/CPMrFJWTOJTul1At6srFkqIRt57pflLSIMxikRKTYUj55vaZOz/SXGVUdgEZTYU/E87+vv6LLmn0ngDcHTFuKZi0bL1awhVtJ6xfkeHnXPWEwtrovCZYXyknQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2016 18:49:27.4260 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0601MB1636 X-OriginatorOrg: netapp.com Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If copy_file_range() returns 0, then that means no data was copied. We should break out of the loop in this case to prevent looping indefinitely. Additionally, if an error is returned by copy_file_range() then we need to print out the string form to be used by error checking tests in xfstests. Signed-off-by: Anna Schumaker --- io/copy_file_range.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/io/copy_file_range.c b/io/copy_file_range.c index eddc634..161bdcf 100644 --- a/io/copy_file_range.c +++ b/io/copy_file_range.c @@ -49,8 +49,11 @@ copy_file_range(int fd, loff_t *src, loff_t *dst, size_t len) do { ret = syscall(__NR_copy_file_range, fd, src, file->fd, dst, len, 0); - if (ret == -1) + if (ret == -1) { + fprintf(stderr, _("copy_range: %s\n"), strerror(errno)); return errno; + } else if (ret == 0) + break; len -= ret; } while (len > 0);