From: Guoqing Jiang Date: Fri, 12 Aug 2016 05:42:34 +0000 (+0800) Subject: md-cluster: call md_kick_rdev_from_array once ack failed X-Git-Tag: v4.9-rc1~94^2~19 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e566aef12a166732b7fd85897f8736ccf4fc7814;p=karo-tx-linux.git md-cluster: call md_kick_rdev_from_array once ack failed The new_disk_ack could return failure if WAITING_FOR_NEWDISK is not set, so we need to kick the dev from array in case failure happened. And we missed to check err before call new_disk_ack othwise we could kick a rdev which isn't in array, thanks for the reminder from Shaohua. Reviewed-by: NeilBrown Signed-off-by: Guoqing Jiang Signed-off-by: Shaohua Li --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 915e84d631a2..7eaf5496c8d9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6101,9 +6101,14 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) export_rdev(rdev); if (mddev_is_clustered(mddev)) { - if (info->state & (1 << MD_DISK_CANDIDATE)) - md_cluster_ops->new_disk_ack(mddev, (err == 0)); - else { + if (info->state & (1 << MD_DISK_CANDIDATE)) { + if (!err) { + err = md_cluster_ops->new_disk_ack(mddev, + err == 0); + if (err) + md_kick_rdev_from_array(rdev); + } + } else { if (err) md_cluster_ops->add_new_disk_cancel(mddev); else