[Devel,RHEL7,COMMIT] fs/block_dev: always invalidate cleancache in invalidate_bdev()

Submitted by Konstantin Khorenko on April 13, 2017, 10:41 a.m.

Details

Message ID 201704131041.v3DAf6Df005307@finist_cl7.x64_64.work.ct
State New
Series "fs/cleancache: fix data invalidation in the cleancache during direct_io"
Headers show

Commit Message

Konstantin Khorenko April 13, 2017, 10:41 a.m.
The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.15
------>
commit 5ffa7e4f1451a245f9fc4ba94df77c2a0e911add
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Thu Apr 13 14:41:06 2017 +0400

    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 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
 	 */