Commit 659b254f authored by Guoqing Jiang's avatar Guoqing Jiang Committed by NeilBrown

md-cluster: remove a disk asynchronously from cluster environment

For cluster raid, if one disk couldn't be reach in one node, then
other nodes would receive the REMOVE message for the disk.

In receiving node, we can't call md_kick_rdev_from_array to remove
the disk from array synchronously since the disk might still be busy
in this node. So let's set a ClusterRemove flag on the disk, then
let the thread to do the removal job eventually.
Signed-off-by: default avatarGuoqing Jiang <gqjiang@suse.com>
Signed-off-by: default avatarGoldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.com>
parent ac277c6a
...@@ -440,8 +440,11 @@ static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg) ...@@ -440,8 +440,11 @@ static void process_remove_disk(struct mddev *mddev, struct cluster_msg *msg)
struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev, struct md_rdev *rdev = md_find_rdev_nr_rcu(mddev,
le32_to_cpu(msg->raid_slot)); le32_to_cpu(msg->raid_slot));
if (rdev) if (rdev) {
md_kick_rdev_from_array(rdev); set_bit(ClusterRemove, &rdev->flags);
set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
md_wakeup_thread(mddev->thread);
}
else else
pr_warn("%s: %d Could not find disk(%d) to REMOVE\n", pr_warn("%s: %d Could not find disk(%d) to REMOVE\n",
__func__, __LINE__, le32_to_cpu(msg->raid_slot)); __func__, __LINE__, le32_to_cpu(msg->raid_slot));
......
...@@ -8318,6 +8318,18 @@ void md_check_recovery(struct mddev *mddev) ...@@ -8318,6 +8318,18 @@ void md_check_recovery(struct mddev *mddev)
goto unlock; goto unlock;
} }
if (mddev_is_clustered(mddev)) {
struct md_rdev *rdev;
/* kick the device if another node issued a
* remove disk.
*/
rdev_for_each(rdev, mddev) {
if (test_and_clear_bit(ClusterRemove, &rdev->flags) &&
rdev->raid_disk < 0)
md_kick_rdev_from_array(rdev);
}
}
if (!mddev->external) { if (!mddev->external) {
int did_change = 0; int did_change = 0;
spin_lock(&mddev->lock); spin_lock(&mddev->lock);
......
...@@ -183,6 +183,7 @@ enum flag_bits { ...@@ -183,6 +183,7 @@ enum flag_bits {
* Usually, this device should be faster * Usually, this device should be faster
* than other devices in the array * than other devices in the array
*/ */
ClusterRemove,
}; };
#define BB_LEN_MASK (0x00000000000001FFULL) #define BB_LEN_MASK (0x00000000000001FFULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment