]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: make cluster raid also could support re-add
authorGuoqing Jiang <gqjiang@suse.com>
Thu, 20 Aug 2015 05:56:31 +0000 (13:56 +0800)
committerNeilBrown <neilb@suse.com>
Mon, 28 Sep 2015 04:55:02 +0000 (14:55 +1000)
If it is a cluster raid, the disc.state need to be
changed accordingly when do re-add.

Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Manage.c

index 494cca9248e763ab1db475b3b7b7f75de9d7a339..b5450dd0d7d80672fd813dc67539266006b61fed 100644 (file)
--- a/Manage.c
+++ b/Manage.c
@@ -669,6 +669,15 @@ int attempt_re_add(int fd, int tfd, struct mddev_dev *dv,
                disc.number = mdi.disk.number;
                disc.raid_disk = mdi.disk.raid_disk;
                disc.state = mdi.disk.state;
+               if (array->state & (1 << MD_SB_CLUSTERED)) {
+                       /* extra flags are needed when adding to a cluster as
+                        * there are two cases to distinguish
+                        */
+                       if (dv->disposition == 'c')
+                               disc.state |= (1 << MD_DISK_CANDIDATE);
+                       else
+                               disc.state |= (1 << MD_DISK_CLUSTER_ADD);
+               }
                if (dv->writemostly == 1)
                        disc.state |= 1 << MD_DISK_WRITEMOSTLY;
                if (dv->writemostly == 2)