Btrfs: still corruption hunting
Signed-off-by: Chris Mason <chris.mason@oracle.com>
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index c4194da..37b87e2 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -173,12 +173,16 @@
if (!pending) {
bh = btrfs_find_tree_block(root, blocknr);
- if (bh && buffer_uptodate(bh)) {
- header = btrfs_buffer_header(bh);
- if (btrfs_header_generation(header) ==
- root->fs_info->running_transaction->transid) {
- btrfs_block_release(root, bh);
- return 0;
+ if (bh) {
+ if (buffer_uptodate(bh)) {
+ u64 transid =
+ root->fs_info->running_transaction->transid;
+ header = btrfs_buffer_header(bh);
+ if (btrfs_header_generation(header) ==
+ transid) {
+ btrfs_block_release(root, bh);
+ return 0;
+ }
}
btrfs_block_release(root, bh);
}
@@ -539,6 +543,8 @@
*/
while(*level >= 0) {
cur = path->nodes[*level];
+ if (btrfs_header_level(btrfs_buffer_header(cur)) != *level)
+ WARN_ON(1);
if (path->slots[*level] >=
btrfs_header_nritems(btrfs_buffer_header(cur)))
break;