Btrfs: Fix block generation verification race
authorYan, Zheng <zheng.yan@oracle.com>
Wed, 26 May 2010 15:20:30 +0000 (11:20 -0400)
committerChris Mason <chris.mason@oracle.com>
Thu, 27 May 2010 01:35:33 +0000 (21:35 -0400)
After the path is released, the generation number got from block
pointer is no long valid. The race may cause disk corruption, because
verify_parent_transid() calls clear_extent_buffer_uptodate() when
generation numbers mismatch.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ctree.c

index acd532a..0d1d966 100644 (file)
@@ -1604,7 +1604,7 @@ read_block_for_search(struct btrfs_trans_handle *trans,
        btrfs_release_path(NULL, p);
 
        ret = -EAGAIN;
-       tmp = read_tree_block(root, blocknr, blocksize, gen);
+       tmp = read_tree_block(root, blocknr, blocksize, 0);
        if (tmp) {
                /*
                 * If the read above didn't mark this buffer up to date,