Btrfs, raid56: fix use-after-free problem in the final device replace procedure on raid56

The commit c404e0dc (Btrfs: fix use-after-free in the finishing
procedure of the device replace) fixed a use-after-free problem
which happened when removing the source device at the end of device
replace, but at that time, btrfs didn't support device replace
on raid56, so we didn't fix the problem on the raid56 profile.
Currently, we implemented device replace for raid56, so we need
kick that problem out before we enable that function for raid56.

The fix method is very simple, we just increase the bio per-cpu
counter before we submit a raid56 io, and decrease the counter
when the raid56 io ends.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
This commit is contained in:
Miao Xie
2014-11-25 16:39:28 +08:00
parent 7603597690
commit 4245215d6a
6 changed files with 45 additions and 20 deletions

View File

@@ -5843,12 +5843,9 @@ int btrfs_map_bio(struct btrfs_root *root, int rw, struct bio *bio,
} else {
ret = raid56_parity_recover(root, bio, bbio,
raid_map, map_length,
mirror_num, 0);
mirror_num, 1);
}
/*
* FIXME, replace dosen't support raid56 yet, please fix
* it in the future.
*/
btrfs_bio_counter_dec(root->fs_info);
return ret;
}