Re: [PATCH v3 5/5] btrfs: Prevent scrub recheck from racing with dev replace

2017-03-29 Thread Liu Bo
On Wed, Mar 29, 2017 at 09:33:22AM +0800, Qu Wenruo wrote: > scrub_setup_recheck_block() calls btrfs_map_sblock() and then access > bbio without protection of bio_counter. > s/access/accesses/ > This can leads to use-after-free if racing with dev replace cancel. > s/leads/lead/ > Fix it by

[PATCH v3 5/5] btrfs: Prevent scrub recheck from racing with dev replace

2017-03-28 Thread Qu Wenruo
scrub_setup_recheck_block() calls btrfs_map_sblock() and then access bbio without protection of bio_counter. This can leads to use-after-free if racing with dev replace cancel. Fix it by increasing bio_counter before calling btrfs_map_sblock() and decrease the bio_counter when corresponding