summaryrefslogtreecommitdiff
path: root/drivers/md/md-cluster.c
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2015-04-14 10:44:44 -0500
committerNeilBrown <neilb@suse.de>2015-04-22 07:59:39 +1000
commit88bcfef7be513e8bf5448e0025330fdd97c4c708 (patch)
tree68cb889fecc9ab303a798bf9b43130701bb34460 /drivers/md/md-cluster.c
parent57d051dccaef395e0d8c0fff02cfc3a77bacc88c (diff)
md-cluster: remove capabilities
This adds "remove" capabilities for the clustered environment. When a user initiates removal of a device from the array, a REMOVE message with disk number in the array is sent to all the nodes which kick the respective device in their own array. This facilitates the removal of failed devices. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md-cluster.c')
-rw-r--r--drivers/md/md-cluster.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 10c44a3a9d6a..30b41b70db17 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -72,6 +72,7 @@ enum msg_type {
METADATA_UPDATED = 0,
RESYNCING,
NEWDISK,
+ REMOVE,
};
struct cluster_msg {
@@ -401,6 +402,16 @@ static void process_metadata_update(struct mddev *mddev, struct cluster_msg *msg
dlm_lock_sync(cinfo->no_new_dev_lockres, DLM_LOCK_CR);
}
+static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg)
+{
+ struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, msg->raid_slot);
+
+ if (rdev)
+ md_kick_rdev_from_array(rdev);
+ else
+ pr_warn("%s: %d Could not find disk(%d) to REMOVE\n", __func__, __LINE__, msg->raid_slot);
+}
+
static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
{
switch (msg->type) {
@@ -419,6 +430,15 @@ static void process_recvd_msg(struct mddev *mddev, struct cluster_msg *msg)
pr_info("%s: %d Received message: NEWDISK from %d\n",
__func__, __LINE__, msg->slot);
process_add_new_disk(mddev, msg);
+ break;
+ case REMOVE:
+ pr_info("%s: %d Received REMOVE from %d\n",
+ __func__, __LINE__, msg->slot);
+ process_remove_disk(mddev, msg);
+ break;
+ default:
+ pr_warn("%s:%d Received unknown message from %d\n",
+ __func__, __LINE__, msg->slot);
}
}
@@ -854,6 +874,15 @@ static int new_disk_ack(struct mddev *mddev, bool ack)
return 0;
}
+static int remove_disk(struct mddev *mddev, struct md_rdev *rdev)
+{
+ struct cluster_msg cmsg;
+ struct md_cluster_info *cinfo = mddev->cluster_info;
+ cmsg.type = REMOVE;
+ cmsg.raid_slot = rdev->desc_nr;
+ return __sendmsg(cinfo, &cmsg);
+}
+
static struct md_cluster_operations cluster_ops = {
.join = join,
.leave = leave,
@@ -868,6 +897,7 @@ static struct md_cluster_operations cluster_ops = {
.add_new_disk_start = add_new_disk_start,
.add_new_disk_finish = add_new_disk_finish,
.new_disk_ack = new_disk_ack,
+ .remove_disk = remove_disk,
};
static int __init cluster_init(void)