From: Filipe Manana Date: Wed, 2 Jul 2014 19:07:54 +0000 (+0100) Subject: Btrfs: read lock extent buffer while walking backrefs X-Git-Tag: v3.17-rc1~5^2~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f7ff6d7832c6be13e8c95598884dbc40ad69fb7;p=profile%2Fcommon%2Fplatform%2Fkernel%2Flinux-artik7.git 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 Signed-off-by: Chris Mason --- 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: ret = -EIO; goto out; } + btrfs_tree_read_lock(eb); + btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); ret = find_extent_in_eb(eb, bytenr, *extent_item_pos, &eie); + btrfs_tree_read_unlock_blocking(eb); free_extent_buffer(eb); if (ret < 0) goto out;