Btrfs: fix unprotected assignment of the left cursor for device replace
authorFilipe Manana <fdmanana@suse.com>
Sat, 14 May 2016 15:32:35 +0000 (16:32 +0100)
committerFilipe Manana <fdmanana@suse.com>
Mon, 30 May 2016 11:58:23 +0000 (12:58 +0100)
commit81e87a736c5581e83f52dc054b368993ec7f16d7
tree35fdb32b543fa5e2d3a50d51875e9c2ade2a99a4
parentf0e9b7d6401959816599191d1d9db90b6fd750db
Btrfs: fix unprotected assignment of the left cursor for device replace

We were assigning new values to fields of the device replace object
without holding the respective lock after processing each device extent.
This is important for the left cursor field which can be accessed by a
concurrent task running __btrfs_map_block (which, correctly, takes the
device replace lock).
So change these fields while holding the device replace lock.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/scrub.c