Patchwork [1/8] buffer: make invalidate_bdev() drain all percpu LRU add caches

login
register
mail settings
Submitter Tejun Heo
Date May 15, 2010, 6:09 p.m.
Message ID <1273946974-29131-2-git-send-email-tj@kernel.org>
Download mbox | patch
Permalink /patch/52715/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Tejun Heo - May 15, 2010, 6:09 p.m.
invalidate_bdev() should release all page cache pages which are clean
and not being used; however, if some pages are still in the percpu LRU
add caches on other cpus, those pages are considered in used and don't
get released.  Fix it by calling lru_add_drain_all() before trying to
invalidate pages.

This problem was discovered while testing block automatic native
capacity unlocking.  Null pages which were read before automatic
unlocking didn't get released by invalidate_bdev() and ended up
interfering with partition scan after unlocking.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 fs/buffer.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
David Miller - May 16, 2010, 7:11 a.m.
From: Tejun Heo <tj@kernel.org>
Date: Sat, 15 May 2010 20:09:27 +0200

> invalidate_bdev() should release all page cache pages which are clean
> and not being used; however, if some pages are still in the percpu LRU
> add caches on other cpus, those pages are considered in used and don't
> get released.  Fix it by calling lru_add_drain_all() before trying to
> invalidate pages.
> 
> This problem was discovered while testing block automatic native
> capacity unlocking.  Null pages which were read before automatic
> unlocking didn't get released by invalidate_bdev() and ended up
> interfering with partition scan after unlocking.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

Acked-by: David S. Miller <davem@davemloft.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/buffer.c b/fs/buffer.c
index c9c266d..08e422d 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -275,6 +275,7 @@  void invalidate_bdev(struct block_device *bdev)
 		return;
 
 	invalidate_bh_lrus();
+	lru_add_drain_all();	/* make sure all lru add caches are flushed */
 	invalidate_mapping_pages(mapping, 0, -1);
 }
 EXPORT_SYMBOL(invalidate_bdev);