summaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2015-03-02 10:55:49 -0600
committerNeilBrown <neilb@suse.de>2015-03-21 10:33:00 +1100
commitfa8259da0e10b189e41ee60907ec2a499bb66019 (patch)
tree68805b72831656cdcb2d13f3b4c8ee393104e2bd /drivers/md/md.c
parent3b0e6aacbfe04fa144c4732f269b09ce91177566 (diff)
downloadblackbird-obmc-linux-fa8259da0e10b189e41ee60907ec2a499bb66019.tar.gz
blackbird-obmc-linux-fa8259da0e10b189e41ee60907ec2a499bb66019.zip
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.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index ae3432e57ccb..eb6f92e57ab6 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);
OpenPOWER on IntegriCloud