From patchwork Fri Apr 14 14:07:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Ryabinin X-Patchwork-Id: 9681291 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 A27CA60326 for ; Fri, 14 Apr 2017 14:08:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93F8128695 for ; Fri, 14 Apr 2017 14:08:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 889292869B; Fri, 14 Apr 2017 14:08:15 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 F3C4128698 for ; Fri, 14 Apr 2017 14:08:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753137AbdDNOII (ORCPT ); Fri, 14 Apr 2017 10:08:08 -0400 Received: from mail-eopbgr50104.outbound.protection.outlook.com ([40.107.5.104]:42301 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751544AbdDNOID (ORCPT ); Fri, 14 Apr 2017 10:08:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ovhx0nKijzpLYg1KIR+0KBY8NDCPKjqljTEsmsWDbmI=; b=TEEjYGA6mu2Sai6ifUJ0WfK7W3MR2C0q5tyMuZ2izp8w3FgD2jORZdUZ/o6C1ooyLgPQh5QhlDI7k6aP6Lodqqxx2NzvCSodEtR2dDV0ylSzSXKtPIjvZLjYX1x8qVh82C0tdpXb3KeJ3MqE4Aad5x9vqmwuAUcuj0qaUWcGsBc= Authentication-Results: zeniv.linux.org.uk; dkim=none (message not signed) header.d=none;zeniv.linux.org.uk; dmarc=none action=none header.from=virtuozzo.com; Received: from localhost.sw.ru (195.214.232.6) by HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Fri, 14 Apr 2017 14:07:56 +0000 From: Andrey Ryabinin To: Alexander Viro , CC: Andrey Ryabinin , Konrad Rzeszutek Wilk , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Steve French , Matthew Wilcox , Ross Zwisler , Trond Myklebust , Anna Schumaker , Andrew Morton , Jan Kara , Jens Axboe , Johannes Weiner , Alexey Kuznetsov , Christoph Hellwig , , , , , , Subject: [PATCH 2/4] fs/block_dev: always invalidate cleancache in invalidate_bdev() Date: Fri, 14 Apr 2017 17:07:51 +0300 Message-ID: <20170414140753.16108-3-aryabinin@virtuozzo.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170414140753.16108-1-aryabinin@virtuozzo.com> References: <20170414140753.16108-1-aryabinin@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: VI1PR08CA0039.eurprd08.prod.outlook.com (10.164.95.49) To HE1PR0801MB2732.eurprd08.prod.outlook.com (10.169.123.152) X-MS-Office365-Filtering-Correlation-Id: 49ed3b75-7350-4d1f-ce88-08d4833fa860 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; H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Mzz9pzPC/R8rVy3Y0Akg=; 20:LIF5jsiPGfM7oGS9NjFaYrYJz61ZMyz76Z0rCbKTmHcWHEJMyTUGPfieJa5ZdI2KMQt8jNCYN7IGCYHaTz4wQEnkqv3TTibFevmDq3hxBfk23MTwGrYffAi2Bf2MOBLIhx9foFDAT5QaJ17B3RdL4GniSSN48OWv31RCrE3gFDp8aV+KP08DhDeftK9CuXNBabH0r66s9uN8uAJlHWszYD8AmKlUHz6pa5Cm8EaNzUELOfmiD6oLABLxzYUSkX5KgSh4l7Vj9o7vxWpx682BjN4LpO4a/HRS+HsVNoDORP/oyVQjMClnuxmmiBYLKU5XYRf3muhmCZI547z4kjyQR6if/IzBhjXHbSvdUfSC/5dIQ0osp4NbGmdnz2fbLnasHTpBNSq67wyPc2FpqTGflWB0ZtX0HxdLwLU5m1S2hvg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:HE1PR0801MB2732; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB2732; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 4:dnHOpoEBdykQwBtyn1lgWA9a3DrHB3hIdv2UEU5MNnkCJMWDJwOo8HMu8WypVEKfbxZD+p5/qyvxN+tyl+2nqzCJiW0lHXyEuqM9CtuRI7YlyBYXL15+j+xe/ocIQiHYjhH/VHzk9w2H+0+CwKTne3BIxzVIztnHOjTUjwfBf4qYiFsGdwfIYh5vqpFauvgOUItbaWOl7rGjTr89bSSBoRY7LdcasPSbuiFqbLWN8piRtHSTY8QdaSrSct+/YSdtI/XMnuyP5UNkTXDYLKQcbMQT2O0WZYUMqsWl1/lzmzqPJhiHqVTxk8jrXTl6YyCfAtWZWK94N6PB7558+3pCBIXZGCBvam9tR2w42Oi5uazbMYacykptl4/kIH9hVN+1zVb0jna0I7was1ZZMLYUG6ukQJnAJueRGKOAUYUZj6hmTCaVDHM5oNrDl5Usl+EGIy2gzIOCFRq6TjjiOvm21curTd17gUROXisF547h/6pNcz7y45pgoQr6YRdSp42gb81eM6oyz9UI1IhSWpkS2D9odMdYR9V+x2Tba3ARiMOWThKQkCq5RPamohUGqMSayfUepKoIPXFA7imx+hdnJTqDA7j4WLAdI+pzjWOYAP8qe4A6l3581pEiZ/MTsFKT37PoulPUE37AF5q+fZQfDnsQHyjbSbd5EfK8UWrsEnWA8lSyQIFMXTptbOAk2K1cdidVg9is/MujRyGVHeZ/RQ== X-Forefront-PRVS: 02778BF158 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6069001)(6009001)(39410400002)(39400400002)(39830400002)(39450400003)(81166006)(6486002)(86362001)(54906002)(7736002)(305945005)(50466002)(66066001)(47776003)(6666003)(5003940100001)(50226002)(48376002)(2950100002)(1076002)(33646002)(53936002)(5660300001)(4326008)(6512007)(50986999)(76176999)(7416002)(25786009)(53416004)(6116002)(3846002)(8666007)(2906002)(36756003)(8676002)(42186005)(6506006)(189998001)(38730400002)(76506005); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB2732; H:localhost.sw.ru; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0801MB2732; 23:wvTWaEEgnT+PmFUy7xrFpM0BI8tkhY/qDo+W+eS?= =?us-ascii?Q?p7aS6XK7gXkO73G3sJxtk0eqxVvFZSGIBho+Og2m7dJjP38Snve9N9uf5RTE?= =?us-ascii?Q?v9X3dVpc7hw+I43wjnKAzMhHG8GFS0hbUnomIH3WxXID3m73rKJJwSP1olzY?= =?us-ascii?Q?IHutnI0em+zatZB2MuEeuaRht3xg+IvSVroqDy4t+k25+IIPxmssFqgiwK/b?= =?us-ascii?Q?VhcXPBYwS+eUTGhj10gK968Gu+ARA4NPKaSE7nsboMv/vKuzt+yPYsPcJ0c6?= =?us-ascii?Q?P6tIKT+KQLsolM9O13DUg9mVKwe304J5s6tlXnhqQod0QUdUf4EKYrfpnMD9?= =?us-ascii?Q?Bu71AVJQWOmSPPWPQHZnIYvg2tkmNBLshNhnlGDyC2mMI9qwwnVNif0Kctmx?= =?us-ascii?Q?1r8ISudK/C8YdiA84+poAe4PR6hzwI9qEvTWzHr1eiwLX6E/0uvIJBeZUE45?= =?us-ascii?Q?3LvnRgfV30uw46sOJbXgp/lnqPj75CejraXsk1+0yAS3/58xS5Vg6UhlsLw6?= =?us-ascii?Q?pFnnsuthPgAqdSLqE3P3ZpktDGTbhjV7LuMtWy0MqtNRbdaCfMPafOHXQC4z?= =?us-ascii?Q?LIbWOhSqn1Qse5mHZGqHVZ1O805qB/BsQvqygbewWy7NAN1iyGAsdBok+BAS?= =?us-ascii?Q?ikkCx9TIEEAP88CYjT4tFF0Oom3soRheeCZTV9G68srmlYn9MYFdO/KEqins?= =?us-ascii?Q?8cJ3e03OzaazfnVXZpyaFmTnR5Kj6KBdY2ZhCnQI7P6+3JDc3rekVOZ8Ipv1?= =?us-ascii?Q?wqapdswLcScjkzVAGlaCn9vuLA4QTKlIwW2B6gnP6Yr57G7qypsaetuHGD8Y?= =?us-ascii?Q?aj1YHAqghAou5Q++yIRuaDlTic5WkcznT6+eLZuOws7soBAxHDVbMgpSx+Hb?= =?us-ascii?Q?etIDXUUQ+xej/mqj02GhLBxO3pVdtts6urVzlJ8UeduDc93yJ+YAibTkwKfd?= =?us-ascii?Q?c/GmfacJ9GBdG/RIlHzcwG4VnjwAAPskRjxi8YfKM6yKQpVlXfNuYI4vf81Z?= =?us-ascii?Q?d69QunEQCpnlgiUoCEb9phpzuzZFaunY43FmhPPBgkvkx5NhgQJYgBbvFPWS?= =?us-ascii?Q?K66iWtL9vaptzIiUpYCSnrnIdwRh5?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 6:XR+/hqQOZiZJ4c6MvG6/TmM4hHglspliAJuG+kucW9HKLfh43tmQ2RAKLa1kfZhT881lKIFYqc22TAANx5wBiz1o5CJ/BfltL2DOYSU90xlNAcBuEaBNc8X4Y4hXcb4pvoSN6MSJcEZhQzqnMfxgo3BQNkF5t2BwULpAFfaEdDbvVgMTqnMFmcUrku9eZ1jga1W5lEwv2elnxgc6ywv1xS+Jd3Stw+Z4A/2Y1UUdrF2BJ07+6m0w7KIyQQMi6EczuDU7IW5PHArnHgPSl+6UXV5hnev2NpSzcFIFDAseFXl+QO0a8jni5w0vyheJQEgiHV+Any37S56I5HqokDd6XP6WQyMjMlohI3PQwDGLd4H647E9Te4feAL4rMhx2Rsz56SFF8WfQHUFm6rb94b8w/+0nFnqF+E/xspiJ+U6nct5njwA/qLMSxvC0AXNfCEkAJrvyM9GHFRJp+Ot3tgOXg==; 5:L0KSO8D84Zu6mKIlU0W3CFFK7h4urJpXcmRhiM9oNHkdQD94vmUlIHSIYcn/5D9fkx9NloCQ0QOPi1w7z7w/nbBoIYkLZFD792ZJR8CMRWI8mUSVypJywecjyh1kSmQteTjwllWgElSZttbKOWcLoQ==; 24:7YThzSd2OomyzuTe9SOWfGnLNecEXrifQdjQUZxs2JxuggCoqTZ7RC10A7IXQXpbCzbQpRLmxio3AyJr3L/RMK2ZmJARejZttuXm14Ezg2I= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB2732; 7:FQW0PYxknOv2Pxc8PB/mDhLNhKtk7jin7YCFNa8K5CtJYB+8VnJkb6PYdDcMG9lTnx5R2aXzZszHU/kLmAZjB8wWiQK3nzG1A4fVa24TFzHveLgZsuWlZ5tbjqdXKWxEizWVClzpeprPJfMJeNHppOQ5thQmdEP+oG+3qba16YiT/sN8aijbS3jgwS9wc6936V97aT2EWx5UqB3mHbnbkfw1mDooHibirKC9Xz6wXRiNh3sXSbIEX3dkh9pterpHkjIV+NMT1D14Bzx4Z5TOH4Oh9RoXgvz/zv+FXXabsyHlEqzI5Sz6W5BRg33rfGVin/KG/hqWPt057jRVmon5LQ==; 20:VuIFf2IVyGrqolObqSSTiSYQRngMvaZnKtljhVUHz+nGrHODvQDFgNaLeVVvzezyrODGfn8NzbcEOHn+GhgY4O9K+3Ad/HWJ/jTOPAeeh6hTGirbTlUIb/sasia8zz4VM7hxF5jWlctSQi8/v/b4mv57YT42ccEoK4bdTEjM8T0= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2017 14:07:56.8426 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2732 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP invalidate_bdev() calls cleancache_invalidate_inode() iff ->nrpages != 0 which doen't make any sense. Make invalidate_bdev() always invalidate cleancache data. Fixes: c515e1fd361c ("mm/fs: add hooks to support cleancache") Signed-off-by: Andrey Ryabinin --- fs/block_dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index e405d8e..7af4787 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -103,12 +103,11 @@ void invalidate_bdev(struct block_device *bdev) { struct address_space *mapping = bdev->bd_inode->i_mapping; - if (mapping->nrpages == 0) - return; - - invalidate_bh_lrus(); - lru_add_drain_all(); /* make sure all lru add caches are flushed */ - invalidate_mapping_pages(mapping, 0, -1); + if (mapping->nrpages) { + invalidate_bh_lrus(); + lru_add_drain_all(); /* make sure all lru add caches are flushed */ + invalidate_mapping_pages(mapping, 0, -1); + } /* 99% of the time, we don't need to flush the cleancache on the bdev. * But, for the strange corners, lets be cautious */