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 <neilb@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
Guoqing Jiang 2016-08-12 13:42:34 +08:00 committed by Shaohua Li
parent 7d1e042314
commit e566aef12a

View File

@ -6101,9 +6101,14 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info)
export_rdev(rdev); export_rdev(rdev);
if (mddev_is_clustered(mddev)) { if (mddev_is_clustered(mddev)) {
if (info->state & (1 << MD_DISK_CANDIDATE)) if (info->state & (1 << MD_DISK_CANDIDATE)) {
md_cluster_ops->new_disk_ack(mddev, (err == 0)); if (!err) {
else { err = md_cluster_ops->new_disk_ack(mddev,
err == 0);
if (err)
md_kick_rdev_from_array(rdev);
}
} else {
if (err) if (err)
md_cluster_ops->add_new_disk_cancel(mddev); md_cluster_ops->add_new_disk_cancel(mddev);
else else