]> git.hungrycats.org Git - linux/commitdiff
[PATCH] direct-io invalidation fix
authorAndrew Morton <akpm@osdl.org>
Thu, 3 Jun 2004 01:05:20 +0000 (18:05 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 3 Jun 2004 01:05:20 +0000 (18:05 -0700)
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 <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/direct-io.c

index 3741932a4b935ea46d1edce63ab0af4b20028500..d498521c97b78d7ec8985060da63ad17462ccc29 100644 (file)
@@ -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);
        }