diff options
author | NeilBrown <neilb@suse.com> | 2015-07-27 03:01:08 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.com> | 2015-07-27 03:01:08 +0200 |
commit | 653299b6991b0a3a5a136d4f547e7675980c9095 (patch) | |
tree | 939ba768702dd86c67a0acdda880da4982cff290 /Manage.c | |
parent | Release mdadm-3.3.3 (diff) | |
parent | Reuse calc_bitmap_size to reduce code size (diff) | |
download | mdadm-653299b6991b0a3a5a136d4f547e7675980c9095.tar.xz mdadm-653299b6991b0a3a5a136d4f547e7675980c9095.zip |
Merge branch 'cluster'
Now that 3.3.3 is out, it is time to include the cluster-support code.
Signed-off-by: NeilBrown <neilb@suse.com>
Diffstat (limited to 'Manage.c')
-rw-r--r-- | Manage.c | 37 |
1 files changed, 34 insertions, 3 deletions
@@ -724,7 +724,8 @@ skip_re_add: int Manage_add(int fd, int tfd, struct mddev_dev *dv, struct supertype *tst, mdu_array_info_t *array, int force, int verbose, char *devname, - char *update, unsigned long rdev, unsigned long long array_size) + char *update, unsigned long rdev, unsigned long long array_size, + int raid_slot) { unsigned long long ldsize; struct supertype *dev_st = NULL; @@ -914,7 +915,10 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, } disc.major = major(rdev); disc.minor = minor(rdev); - disc.number =j; + if (raid_slot < 0) + disc.number = j; + else + disc.number = raid_slot; disc.state = 0; if (array->not_persistent==0) { int dfd; @@ -955,6 +959,14 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv, } free(used); } + + if (array->state & (1 << MD_SB_CLUSTERED)) { + 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 (tst->ss->external) { @@ -1274,6 +1286,7 @@ int Manage_subdevs(char *devname, int fd, * variant on 'A' * 'F' - Another variant of 'A', where the device was faulty * so must be removed from the array first. + * 'c' - confirm the device as found (for clustered environments) * * For 'f' and 'r', the device can also be a kernel-internal * name such as 'sdb'. @@ -1289,6 +1302,7 @@ int Manage_subdevs(char *devname, int fd, struct mdinfo info; int frozen = 0; int busy = 0; + int raid_slot = -1; if (ioctl(fd, GET_ARRAY_INFO, &array)) { pr_err("Cannot get array info for %s\n", @@ -1317,6 +1331,17 @@ int Manage_subdevs(char *devname, int fd, int rv; int mj,mn; + raid_slot = -1; + if (dv->disposition == 'c') { + rv = parse_cluster_confirm_arg(dv->devname, + &dv->devname, + &raid_slot); + if (!rv) { + pr_err("Could not get the devname of cluster\n"); + goto abort; + } + } + if (strcmp(dv->devname, "failed") == 0 || strcmp(dv->devname, "faulty") == 0) { if (dv->disposition != 'A' @@ -1342,6 +1367,11 @@ int Manage_subdevs(char *devname, int fd, if (strcmp(dv->devname, "missing") == 0) { struct mddev_dev *add_devlist = NULL; struct mddev_dev **dp; + if (dv->disposition == 'c') { + rv = ioctl(fd, CLUSTERED_DISK_NACK, NULL); + break; + } + if (dv->disposition != 'A') { pr_err("'missing' only meaningful with --re-add\n"); goto abort; @@ -1472,6 +1502,7 @@ int Manage_subdevs(char *devname, int fd, case 'A': case 'M': /* --re-add missing */ case 'F': /* --re-add faulty */ + case 'c': /* --cluster-confirm */ /* add the device */ if (subarray) { pr_err("Cannot add disks to a \'member\' array, perform this operation on the parent container\n"); @@ -1505,7 +1536,7 @@ int Manage_subdevs(char *devname, int fd, } rv = Manage_add(fd, tfd, dv, tst, &array, force, verbose, devname, update, - rdev, array_size); + rdev, array_size, raid_slot); close(tfd); tfd = -1; if (rv < 0) |