Commit d6381084 authored by Jan Schmidt's avatar Jan Schmidt

Btrfs: fix extent buffer reference for tree mod log roots

In get_old_root we grab a lock on the extent buffer before we obtain a
reference on that buffer. That order is changed now.
Signed-off-by: default avatarJan Schmidt <list.btrfs@jan-o-sch.net>
parent 5b6602e7
...@@ -1279,6 +1279,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq) ...@@ -1279,6 +1279,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
if (!eb) if (!eb)
return NULL; return NULL;
extent_buffer_get(eb);
btrfs_tree_read_lock(eb); btrfs_tree_read_lock(eb);
if (old_root) { if (old_root) {
btrfs_set_header_bytenr(eb, eb->start); btrfs_set_header_bytenr(eb, eb->start);
...@@ -1291,7 +1292,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq) ...@@ -1291,7 +1292,6 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
__tree_mod_log_rewind(eb, time_seq, tm); __tree_mod_log_rewind(eb, time_seq, tm);
else else
WARN_ON(btrfs_header_level(eb) != 0); WARN_ON(btrfs_header_level(eb) != 0);
extent_buffer_get(eb);
WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root)); WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root));
return eb; return eb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment