All the r1bio should be freed before raid1_reshape() changes the mempool. However, freeze_array() doesn't guarantee there's no r1bio, as some r1bio maybe queued. Also, in raid1_write_request(), handle_read_error() and raid_end_bio_io() , kernel shall not allow_barrier() before the r1bio is properly handled. -> v2: - fix the problem one by one instead of calling blk_mq_freeze_queue() as suggested by Yu Kuai -> v3: - add freeze_array_totally() to replace freeze_array() instead of gave up in raid1_reshape() - add a missed fix in raid_end_bio_io() - add a small check at the start of raid1_reshape() Xueshi Hu (3): md/raid1: freeze array more strictly when reshape md/raid1: don't allow_barrier() before r1bio got freed md/raid1: check array size before reshape drivers/md/raid1.c | 59 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 11 deletions(-) -- 2.40.1