aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAndrey Ryabinin <aryabinin@virtuozzo.com>2017-05-03 17:56:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-20 08:28:39 -0400
commit945d0ecdd9bddf87809525cbc202a1186a65be8c (patch)
tree5beab7c80a5a5a356065e0add05a67231d7f68a3 /fs
parent091784ae973837a11d9d894f2aee63a44af641af (diff)
fs/block_dev: always invalidate cleancache in invalidate_bdev()
commit a5f6a6a9c72eac38a7fadd1a038532bc8516337c upstream. 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@virtuozzo.com Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com> Reviewed-by: Jan Kara <jack@suse.cz> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Alexey Kuznetsov <kuznet@virtuozzo.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Nikolay Borisov <n.borisov.lkml@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9ad527ff9974..2924bddb4a94 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -102,12 +102,11 @@ void invalidate_bdev(struct block_device *bdev)
102{ 102{
103 struct address_space *mapping = bdev->bd_inode->i_mapping; 103 struct address_space *mapping = bdev->bd_inode->i_mapping;
104 104
105 if (mapping->nrpages == 0) 105 if (mapping->nrpages) {
106 return; 106 invalidate_bh_lrus();
107 107 lru_add_drain_all(); /* make sure all lru add caches are flushed */
108 invalidate_bh_lrus(); 108 invalidate_mapping_pages(mapping, 0, -1);
109 lru_add_drain_all(); /* make sure all lru add caches are flushed */ 109 }
110 invalidate_mapping_pages(mapping, 0, -1);
111 /* 99% of the time, we don't need to flush the cleancache on the bdev. 110 /* 99% of the time, we don't need to flush the cleancache on the bdev.
112 * But, for the strange corners, lets be cautious 111 * But, for the strange corners, lets be cautious
113 */ 112 */