From patchwork Mon Jan 30 23:49:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovskiy X-Patchwork-Id: 9546197 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 48020604CC for ; Mon, 30 Jan 2017 23:50:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C5D5283ED for ; Mon, 30 Jan 2017 23:50:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E37128406; Mon, 30 Jan 2017 23:50:02 +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 46511283ED for ; Mon, 30 Jan 2017 23:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753452AbdA3Xt7 (ORCPT ); Mon, 30 Jan 2017 18:49:59 -0500 Received: from mail-bl2nam02on0104.outbound.protection.outlook.com ([104.47.38.104]:27752 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753328AbdA3Xt6 (ORCPT ); Mon, 30 Jan 2017 18:49:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=IOfRb0B5bo2oUrg5T1yaJY73CeZKDWCe3fIjDdioaeg=; b=ekOsqKA8j+km/Cm0IWzFZwxgcRX/op3gjFUv6EW1yclq3OtjPWC6yP2vtcqxG6ARGOC7/gDkB8YnUXFKQcwKKKLWGz0VLkhRObuOs0haOhijU3gccjoa+il1zn8VKyCPNWBUzaPknY6Sh4eAJf8d/TEAaYdN7FQJpc1J6kl6snI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pshilov@microsoft.com; Received: from ubuntu-vm.corp.microsoft.com (2001:4898:80e8:9::63b) by DM5PR03MB2555.namprd03.prod.outlook.com (10.168.196.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Mon, 30 Jan 2017 23:49:56 +0000 From: Pavel Shilovsky To: , Steve French Subject: [PATCH] CIFS: Fix splice read for non-cached files Date: Mon, 30 Jan 2017 15:49:49 -0800 Message-ID: <1485820189-11841-1-git-send-email-pshilov@microsoft.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:9::63b] X-ClientProxiedBy: MWHPR20CA0010.namprd20.prod.outlook.com (10.171.151.148) To DM5PR03MB2555.namprd03.prod.outlook.com (10.168.196.21) X-MS-Office365-Filtering-Correlation-Id: 028950b9-937d-4c42-581e-08d4496ab1a7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401076); SRVR:DM5PR03MB2555; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2555; 3:Z9EIyXtcbJ4x97byXBqzafyqXfpQQXr/YXPlbmQhyw6XSX+Yzqix0+/oaJ0qd3bC/l0kla6wYE5NEb6ww0M97WNKi6obXmTR5KLRGh+uCB+I+Ncz3Z18ceMAwVoaGsYy3spO6i9yMgHOJW0NdtC1ZMsaJKOhyyvgNpG/c4OXpLJu1VFJEvE08tjA3Dq+oaYzrZS8lJfqColEXld+D2IEUJCaElMu4E7VftlRcuKoqlHo2L13VWhMqgt6W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BEcuOF8GECkX8ly1XBATr7g3Y0o+CZNvKdcgBalt7cNyFdj9lV2uaRwL5l7c36TfB/ISU5JcWKfj1Ebg4ZDkuVtKi9FUndgJuPMIoBd6BETuAEJ0k0pVEVqS5NJ3mx3+97FKW/IFajy46WREBMdwVQJ5Jy7Jxq2TNFY5dPrUsuKbc+Gx9sEytNz/Pdb+o+msMYIJ8fPWQqV7Pp9wDdo2Fwf3sVLrXRUBxrZ1yVSsNujmxgVr5gU8/XiU2NlKeUpXKbamdP6KU X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123560025)(20161123562025)(20161123555025)(20161123564025)(6072148)(6047074); SRVR:DM5PR03MB2555; BCL:0; PCL:0; RULEID:; SRVR:DM5PR03MB2555; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2555; 4:9CueyHaOL+RtNPIgbLdaOD4l0cQAJJPJfLvjTMGL3A1EDoRXb9myUc4P6MWyE3QXJRRmGPBZXWLyNdX1G2NwMBYH+D2C6l7s2doTwW4JzYAQmgC7EY5QeCqaKX8D90JG0aIg9VdaMGLWTwpMKubn8XE2MNhSEE6+kugpWIfpIpmOVwQpfxnH/kwgySocjQvGIOfntLhB2q2QQE/FPa9p1e/SgOEyYhMlQ+wEXxXTjp3PJBszoLEf7Yi52T1SWm+cbqeCvAOnTOm7gauDveBgX1ZFH5ZZ4gYomzz9dG+lPWVfktxtxQlj8OXgIfDpx+khXv2RQ75BZ1JaepumZmFhSmHVJSfuC1ygKpm+muUbV6x6GB3HWOWmsEfeeFfTNb5WSQPXPlfFd07ZpADs1GtzEFDcUjo2EJVu9zTUaXm+67p0EYwFXolu0ngUu0vnpm4XPr/zjA1k21COhkv3BDHYQxcuEC+Gnq5LJQQ/Zexzw2/DtyjfjWO3nSlIlZ1koSrRCzUaQjtPP9inMk87a+GC3c2mPlQLw6xrQZjHm+yVE14bTtXXcIGawnuA+2O6h3v0e9oGQPSLTf3hpMzs60+X0TLhkzLWggZQwM6qSL5LmIl1tAU2bkLbFqFIQnxb4wvV97l6xmAECGS8Kn76gzBtag== X-Forefront-PRVS: 0203C93D51 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(39410400002)(39450400003)(39850400002)(39840400002)(39860400002)(189002)(199003)(6486002)(38730400001)(81156014)(305945005)(68736007)(42186005)(106356001)(81166006)(92566002)(8676002)(105586002)(101416001)(2906002)(7736002)(6116002)(5005710100001)(39060400001)(25786008)(50226002)(5660300001)(6666003)(10090500001)(10290500002)(36756003)(48376002)(107886002)(5001770100001)(97736004)(53936002)(189998001)(86612001)(86362001)(50466002)(5003940100001)(47776003)(33646002)(50986999); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR03MB2555; H:ubuntu-vm.corp.microsoft.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2555; 23:5wN8wCY8S1Dct6Yh1XOA3ouBXmYkRLWK7/sJCUhfG?= =?us-ascii?Q?spPOZZUOaUdAqac/vY5iVojXp5L21CHy1RDrSGBPZIgHffeJg9wYvGIbNjrz?= =?us-ascii?Q?Ickf/nyrKbrBahgmREzoCbzdWBtGErOp8K2TvjBR9QNiWoqvmj3AVqm2qPY9?= =?us-ascii?Q?az5nnv1qkVyh1igyGy5HKL2i5VkN8GscYM4WXCD3hHkMW3OHgB6G092Wk/QV?= =?us-ascii?Q?GH9l8a6o+8BO13sCb/i1JcYOUsGSlMqUbpYXHvLa+tvuurKRASEpLILO/eGX?= =?us-ascii?Q?lrchHLwOIkhX94lXAuhhIOW9elk/7dZdVtRw6wPngam3GDNr5DPyanNlTYMB?= =?us-ascii?Q?RHIEMEchlnbkOQnW0/DVLGC1rAgGpfivxoyQP7l4USDoBRlvFjqVOBhraT/l?= =?us-ascii?Q?hEb6/EMtLU1+35rT4B1+fYywZ5yu+kamQoNqwznrb4stgF5iX5FnTmZ6bk+M?= =?us-ascii?Q?Pa5NKt0LxH3/e5JgDG+6i/UuEInRlawYcjLHVD13mJw6t3Et0V2KX0tFbW6l?= =?us-ascii?Q?o8GnvoBLu/gUcnJc7Ra6WPmFoKkkDGUtlmrgNYdLHXdghpcUoN99cTSLOJBm?= =?us-ascii?Q?hKXpPgPfx/NgW3YQLoCp2/auVxiSb9qHqXv41lj6gKPdSjdsJTDrekUZ6EtD?= =?us-ascii?Q?dr3jVAtOEX9F892Rp3w4Miofnx2APOlRhkouiQZZPf/9782dBxdM4qsonskd?= =?us-ascii?Q?KVxBbGv9wcXi8p3cR6AUxCTzEUGemfCwd9VJkhflJqgcq8pceylc3h1UAqW1?= =?us-ascii?Q?vW3XnHihJC12rCX70+Z9IKf3YmDQqh3S7HNDoUY5PJkBqPs2VLKCnYhWd00X?= =?us-ascii?Q?jSonQk3+OxYD7sqfz8yiOij75LwBXsm4kup7cVoLbnOi8B5hnAsy1XBrsFe5?= =?us-ascii?Q?Q7VHdNbohFfvODReX7PIFHkwYUsL1KLpYl8rqWgm4c45LeduEbPP1+GIl1fb?= =?us-ascii?Q?GL7EkWRfHkyGke+bJm+l7okvTk22fnItPekkVXvVLMAk/ag2a3rO+ed3aLga?= =?us-ascii?Q?3AuR7HSqy3WLNIeJLoeiVl5+fFGAKqoERWlr0NCX6W100ULb3RLQmNgYGGhT?= =?us-ascii?Q?rCQ5Btgu/jhXEr+ky6LPelOaR8OlyS30o1aVrQb2KspDUgL3q1gIU8LkhEP7?= =?us-ascii?Q?TdrCvkgdnars+1AKCmaskuE5lIdK23sXZxGI2XSEy56vmQyZBNJ11mfXYpM5?= =?us-ascii?Q?hFkb8S5UC5K2QzmCMPk7J4IXy1v67a96P9d?= X-Microsoft-Exchange-Diagnostics: 1;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6/W/mKoWrdCifWMo2bBBlnNoU4X3Cyn6eeT0XKYAiwHVMH8lFo56vNehu+Uu6qO+X4qazR+M54zEJp9c3xVEc0HPtJAiPfjmY37YS3y0++ZmqGrlHHchS4J478l8BOapyBYW8CG4XxAaPfcpM6Tudka98FGPTvtk+9KBAcGb+q05NkRCB2VSgmwjEXtSJlk51Pqght6RD/f9qgw== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2017 23:49:56.0276 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2555 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently we call copy_page_to_iter() for uncached reading into a pipe. This is wrong because it treats pages as VFS cache pages and copies references rather than actual data. When we are trying to read from the pipe we end up calling page_cache_pipe_buf_confirm() which returns -ENODATA. This error is translated into 0 which is returned to a user. This issue is reproduced by running xfs-tests suite (generic test #249) against mount points with "cache=none". Fix it by mapping pages manually and calling copy_to_iter() that copies data into the pipe. Cc: Stable Signed-off-by: Pavel Shilovsky --- fs/cifs/file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 18a1e1d..7e23261 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2884,7 +2884,14 @@ cifs_readdata_to_iov(struct cifs_readdata *rdata, struct iov_iter *iter) for (i = 0; i < rdata->nr_pages; i++) { struct page *page = rdata->pages[i]; size_t copy = min_t(size_t, remaining, PAGE_SIZE); - size_t written = copy_page_to_iter(page, 0, copy, iter); + size_t written; + + if (unlikely(iter->type & ITER_PIPE)) { + void *addr = kmap_atomic(page); + written = copy_to_iter(addr, copy, iter); + kunmap_atomic(addr); + } else + written = copy_page_to_iter(page, 0, copy, iter); remaining -= written; if (written < copy && iov_iter_count(iter) > 0) break;