aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/backref.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2014-07-02 15:07:54 -0400
committerChris Mason <clm@fb.com>2014-08-15 10:43:13 -0400
commit6f7ff6d7832c6be13e8c95598884dbc40ad69fb7 (patch)
tree77cfeb9532c7eb15a9d6a1c880066e49e24a9e96 /fs/btrfs/backref.c
parente339a6b097c515a31ce230d498c44ff2e89f1cf4 (diff)
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: Filipe Manana <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r--fs/btrfs/backref.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index e25564bfcb46..a1efd39ca28a 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -1001,8 +1001,11 @@ again:
1001 ret = -EIO; 1001 ret = -EIO;
1002 goto out; 1002 goto out;
1003 } 1003 }
1004 btrfs_tree_read_lock(eb);
1005 btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK);
1004 ret = find_extent_in_eb(eb, bytenr, 1006 ret = find_extent_in_eb(eb, bytenr,
1005 *extent_item_pos, &eie); 1007 *extent_item_pos, &eie);
1008 btrfs_tree_read_unlock_blocking(eb);
1006 free_extent_buffer(eb); 1009 free_extent_buffer(eb);
1007 if (ret < 0) 1010 if (ret < 0)
1008 goto out; 1011 goto out;