From: Yu Kuai <yukuai3@xxxxxxxxxx> This commit is used to fix a problem for md/raid, due to rdev lifetime in conf is different from the array. However, on the one hand, the management of rdev is completely different from dm-raid; on the other hand, this commit breaks dm-raid and the test shell/integrity-caching.sh will hang. The root cause of the hang is still not clear yet, however, let's revert the commit for dm-raid to prevent regression first. We can decide what to do after figuring out the root cause. Fixes: fa2bbff7b0b4 ("md: synchronize flush io with array reconfiguration") Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx> --- drivers/md/md.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index ba45c7be3dbe..7db749ba7e60 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -544,7 +544,8 @@ static void md_end_flush(struct bio *bio) if (atomic_dec_and_test(&mddev->flush_pending)) { /* The pair is percpu_ref_get() from md_flush_request() */ - percpu_ref_put(&mddev->active_io); + if (mddev->gendisk) + percpu_ref_put(&mddev->active_io); /* The pre-request flush has finished */ queue_work(md_wq, &mddev->flush_work); @@ -640,7 +641,8 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio) * concurrently. */ WARN_ON(percpu_ref_is_zero(&mddev->active_io)); - percpu_ref_get(&mddev->active_io); + if (mddev->gendisk) + percpu_ref_get(&mddev->active_io); mddev->flush_bio = bio; bio = NULL; } -- 2.39.2