Skip to contentSkip to conversation

btrfs: Fix block generation verification race

PATCH New Yan, Zheng 1 participant 1 message May 3, 2010 Btrfs file system

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 btrfs: Fix block generation verification race

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.

---

fs/btrfs/ctree.c +1 -1
diff -urp 1/fs/btrfs/ctree.c 2/fs/btrfs/ctree.c
@@ -1589,7 +1589,7 @@ read_block_for_search(struct btrfs_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,