In ops_run_io(), if call md_wait_for_blocked_rdev which it dec nr_pending, the rdev->nr_pending will dec again in else-statement. So the nr_penging is error and we can't remove this device. Signed-off-by: majianpeng <majianpeng@xxxxxxxxx> --- drivers/md/raid5.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index d267672..995b2de 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -607,6 +607,12 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) md_check_recovery(conf->mddev); } md_wait_for_blocked_rdev(rdev, conf->mddev); + /* + * Because md_wait_for_blocked_rdev will dec + * nr_pending,we must add.The real dec is in + * else statement. + */ + atomic_inc(&rdev->nr_pending); } else { /* Acknowledged bad block - skip the write */ rdev_dec_pending(rdev, conf->mddev); -- 1.7.5.4 -------------- majianpeng?韬{.n?????%??檩??w?{.n???{炳盯w???塄}?财??j:+v??????2??璀??摺?囤??z夸z罐?+?????w棹f