Commit 6f7ff6d7 authored by Filipe Manana's avatar Filipe Manana Committed by Chris Mason

Btrfs: read lock extent buffer while walking backrefs

Before processing the extent buffer, acquire a read lock on it, so
that we're safe against concurrent updates on the extent buffer.
Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent e339a6b0
...@@ -1001,8 +1001,11 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -1001,8 +1001,11 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
ret = -EIO; ret = -EIO;
goto out; goto out;
} }
btrfs_tree_read_lock(eb);
btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
ret = find_extent_in_eb(eb, bytenr, ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie); *extent_item_pos, &eie);
btrfs_tree_read_unlock_blocking(eb);
free_extent_buffer(eb); free_extent_buffer(eb);
if (ret < 0) if (ret < 0)
goto out; goto out;
......
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