From de9aa967313bcc76b06aafc31f008119f9b716ee Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 2 Jun 2004 18:05:20 -0700 Subject: [PATCH] [PATCH] direct-io invalidation fix clean_blockdev_aliases() is using the wrong thing to work out how many filesystem blocks should be invalidated. It invalidates too many, which can cause live fs metadata buffers to be invalidated when they are pending writeout. It's a filesystem-wrecker, although seems very hard to hit. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/direct-io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/direct-io.c b/fs/direct-io.c index 3741932a4b935..d498521c97b78 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -690,8 +690,11 @@ out: static void clean_blockdev_aliases(struct dio *dio) { unsigned i; + unsigned nblocks; - for (i = 0; i < dio->blocks_available; i++) { + nblocks = dio->map_bh.b_size >> dio->inode->i_blkbits; + + for (i = 0; i < nblocks; i++) { unmap_underlying_metadata(dio->map_bh.b_bdev, dio->map_bh.b_blocknr + i); } -- 2.53.0