The patch titled Subject: fs/block_dev: always invalidate cleancache in invalidate_bdev() has been added to the -mm tree. Its filename is fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Subject: fs/block_dev: always invalidate cleancache in invalidate_bdev() 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") Link: http://lkml.kernel.org/r/20170424164135.22350-3-aryabinin@xxxxxxxxxxxxx Signed-off-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx> Reviewed-by: Jan Kara <jack@xxxxxxx> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Cc: Alexander Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx Cc: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> Cc: Jens Axboe <axboe@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Alexey Kuznetsov <kuznet@xxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Nikolay Borisov <n.borisov.lkml@xxxxxxxxx Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/block_dev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff -puN fs/block_dev.c~fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev fs/block_dev.c --- a/fs/block_dev.c~fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev +++ a/fs/block_dev.c @@ -103,12 +103,11 @@ void invalidate_bdev(struct block_device { 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 */ _ Patches currently in -mm which might be from aryabinin@xxxxxxxxxxxxx are fs-fix-data-invalidation-in-the-cleancache-during-direct-io.patch fs-block_dev-always-invalidate-cleancache-in-invalidate_bdev.patch mm-truncate-bail-out-early-from-invalidate_inode_pages2_range-if-mapping-is-empty.patch mm-truncate-avoid-pointless-cleancache_invalidate_inode-calls.patch