[Devel,rh7,3/3] fs/block_dev: always invalidate cleancache in invalidate_bdev()

Submitted by Andrey Ryabinin on April 12, 2017, 3:52 p.m.

Details

Message ID 20170412155233.1707-3-aryabinin@virtuozzo.com
State New
Series "fs/cleancache: fix data invalidation in the cleancache during direct_io"
Headers show

Commit Message

Andrey Ryabinin April 12, 2017, 3:52 p.m.
invalidate_bdev() calls cleancache_invalidate_inode() iff ->nrpages != 0
which doen't make any sense.
Make invalidate_bdev() always invalidate cleancache data.

https://jira.sw.ru/browse/PSBM-63908
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 fs/block_dev.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 967588e..8f2c6ee 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -108,12 +108,12 @@  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);
+	/* FIXME: Shouldn't we add '|| mapping->nrexceptional' ? */
+	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
 	 */