diff options
author | Goldwyn Rodrigues <rgoldwyn@suse.de> | 2015-03-02 16:55:49 (GMT) |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-03-20 23:33:00 (GMT) |
commit | fa8259da0e10b189e41ee60907ec2a499bb66019 (patch) | |
tree | 68805b72831656cdcb2d13f3b4c8ee393104e2bd /drivers/md/md.c | |
parent | 3b0e6aacbfe04fa144c4732f269b09ce91177566 (diff) | |
download | linux-fa8259da0e10b189e41ee60907ec2a499bb66019.tar.xz |
md: Fix stray --cluster-confirm crash
A --cluster-confirm without an --add (by another node) can
crash the kernel.
Fix it by guarding it using a state.
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index ae3432e..eb6f92e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5755,7 +5755,7 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) if (mddev_is_clustered(mddev) && !(info->state & ((1 << MD_DISK_CLUSTER_ADD) | (1 << MD_DISK_CANDIDATE)))) { - pr_err("%s: Cannot add to clustered mddev. Try --cluster-add\n", + pr_err("%s: Cannot add to clustered mddev.\n", mdname(mddev)); return -EINVAL; } @@ -5853,7 +5853,11 @@ static int add_new_disk(struct mddev *mddev, mdu_disk_info_t *info) if (info->state & (1 << MD_DISK_CANDIDATE)) { /* Through --cluster-confirm */ set_bit(Candidate, &rdev->flags); - md_cluster_ops->new_disk_ack(mddev, true); + err = md_cluster_ops->new_disk_ack(mddev, true); + if (err) { + export_rdev(rdev); + return err; + } } else if (info->state & (1 << MD_DISK_CLUSTER_ADD)) { /* --add initiated by this node */ err = md_cluster_ops->add_new_disk_start(mddev, rdev); |