From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1176381AbdDYIfA (ORCPT ); Tue, 25 Apr 2017 04:35:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:37314 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S980467AbdDYIeu (ORCPT ); Tue, 25 Apr 2017 04:34:50 -0400 Date: Tue, 25 Apr 2017 10:34:46 +0200 From: Jan Kara To: Andrey Ryabinin Cc: Alexander Viro , stable@vger.kernel.org, Konrad Rzeszutek Wilk , Ross Zwisler , Andrew Morton , Jan Kara , Jens Axboe , Johannes Weiner , Alexey Kuznetsov , Christoph Hellwig , Nikolay Borisov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 2/4] fs/block_dev: always invalidate cleancache in invalidate_bdev() Message-ID: <20170425083446.GC2793@quack2.suse.cz> References: <20170414140753.16108-1-aryabinin@virtuozzo.com> <20170424164135.22350-1-aryabinin@virtuozzo.com> <20170424164135.22350-3-aryabinin@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170424164135.22350-3-aryabinin@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 24-04-17 19:41:33, Andrey Ryabinin wrote: > invalidate_bdev() calls cleancache_invalidate_inode() iff ->nrpages != 0 > which doen't make any sense. > Make sure that invalidate_bdev() always calls cleancache_invalidate_inode() > regardless of mapping->nrpages value. > > Fixes: c515e1fd361c ("mm/fs: add hooks to support cleancache") > Signed-off-by: Andrey Ryabinin > Acked-by: Konrad Rzeszutek Wilk > Cc: Looks good. You can add: Reviewed-by: Jan Kara Honza > --- > 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 065d7c5..f625dce 100644 > --- a/fs/block_dev.c > +++ b/fs/block_dev.c > @@ -104,12 +104,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 > */ > -- > 2.10.2 > -- Jan Kara SUSE Labs, CR