diff options
author | Andrey Ryabinin <[email protected]> | 2017-05-03 14:56:02 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2017-05-03 15:52:12 -0700 |
commit | a5f6a6a9c72eac38a7fadd1a038532bc8516337c (patch) | |
tree | 47e96c453e48f766e94db9be4cf77dca2b6f4dcc | |
parent | 55635ba76ef91f26b418702ace5e6287eb727f6a (diff) |
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/[email protected]
Signed-off-by: Andrey Ryabinin <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Acked-by: Konrad Rzeszutek Wilk <[email protected]>
Cc: Alexander Viro <[email protected]>
Cc: Ross Zwisler <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Alexey Kuznetsov <[email protected]>
Cc: Christoph Hellwig <[email protected]>
Cc: Nikolay Borisov <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | fs/block_dev.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 9ccabe3bb7de..0d435c794d76 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 */ |