diff options
-rw-r--r-- | fs/btrfs/ctree.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index eba44b076829..cdfb4c49a806 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -1241,6 +1241,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1241 | { | 1241 | { |
1242 | struct tree_mod_elem *tm; | 1242 | struct tree_mod_elem *tm; |
1243 | struct extent_buffer *eb; | 1243 | struct extent_buffer *eb; |
1244 | struct extent_buffer *old; | ||
1244 | struct tree_mod_root *old_root = NULL; | 1245 | struct tree_mod_root *old_root = NULL; |
1245 | u64 old_generation = 0; | 1246 | u64 old_generation = 0; |
1246 | u64 logical; | 1247 | u64 logical; |
@@ -1264,13 +1265,14 @@ get_old_root(struct btrfs_root *root, u64 time_seq) | |||
1264 | btrfs_tree_read_unlock(root->node); | 1265 | btrfs_tree_read_unlock(root->node); |
1265 | free_extent_buffer(root->node); | 1266 | free_extent_buffer(root->node); |
1266 | blocksize = btrfs_level_size(root, old_root->level); | 1267 | blocksize = btrfs_level_size(root, old_root->level); |
1267 | eb = read_tree_block(root, logical, blocksize, 0); | 1268 | old = read_tree_block(root, logical, blocksize, 0); |
1268 | if (!eb) { | 1269 | if (!old) { |
1269 | pr_warn("btrfs: failed to read tree block %llu from get_old_root\n", | 1270 | pr_warn("btrfs: failed to read tree block %llu from get_old_root\n", |
1270 | logical); | 1271 | logical); |
1271 | WARN_ON(1); | 1272 | WARN_ON(1); |
1272 | } else { | 1273 | } else { |
1273 | eb = btrfs_clone_extent_buffer(eb); | 1274 | eb = btrfs_clone_extent_buffer(old); |
1275 | free_extent_buffer(old); | ||
1274 | } | 1276 | } |
1275 | } else if (old_root) { | 1277 | } else if (old_root) { |
1276 | btrfs_tree_read_unlock(root->node); | 1278 | btrfs_tree_read_unlock(root->node); |