]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Btrfs: read lock extent buffer while walking backrefs
authorFilipe Manana <fdmanana@suse.com>
Wed, 2 Jul 2014 19:07:54 +0000 (20:07 +0100)
committerChris Mason <clm@fb.com>
Fri, 15 Aug 2014 14:43:13 +0000 (07:43 -0700)
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>
fs/btrfs/backref.c

index e25564bfcb463383e94eba0ce7f2f3769898afe7..a1efd39ca28ab15bb6b8279cc275ce21ab2c06f4 100644 (file)
@@ -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;