summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2010-06-15 17:55:41 -0700
committerDan Williams <dan.j.williams@intel.com>2010-06-15 17:55:41 -0700
commit33414a0182ae193150f65f7bca97a7e4d818a49e (patch)
treeb468723303ac3fa1e9f452cf2dd43cd94ab4e0e5 /mdadm.c
parent200871adf9e15d5ad985f28c349fd89c386ef48a (diff)
downloadmdadm-33414a0182ae193150f65f7bca97a7e4d818a49e.tar.gz
mdadm-33414a0182ae193150f65f7bca97a7e4d818a49e.tar.xz
mdadm-33414a0182ae193150f65f7bca97a7e4d818a49e.zip
Kill subarray v2
Support for deleting a subarray out of a container. When all subarrays are deleted the component devices are converted back into spares, a --zero-superblock is still needed to kill the remaining metadata at this point. This operation is blocked when the subarray is active and may also be blocked by the metadata handler when deleting the subarray might change the uuid of other active subarrays. For example, with imsm, deleting subarray 'n' may change the uuid of subarrays with indexes > n. Deleting a subarray needs to be a container wide event to ensure disks that record the modified subarray list perceive other disks that did not receive this change as out of date. Notes: The st->subarray parsing in super-intel.c and super-ddf.c is updated to be more strict now that we are reading user supplied subarray values. Offline container modification shares actions that mdmon typically handles so promote is_container_member() and version_to_superswitch() (formerly find_metadata_methods()) to generic utility functions for the cases where mdadm performs the operation. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mdadm.c b/mdadm.c
index d5e34c0..446fab8 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -103,6 +103,7 @@ int main(int argc, char *argv[])
int dosyslog = 0;
int rebuild_map = 0;
int auto_update_home = 0;
+ char *subarray = NULL;
int print_help = 0;
FILE *outf;
@@ -216,6 +217,9 @@ int main(int argc, char *argv[])
case 'W':
case Waitclean:
case DetailPlatform:
+ case KillSubarray:
+ if (opt == KillSubarray)
+ subarray = optarg;
case 'K': if (!mode) newmode = MISC; break;
}
if (mode && newmode == mode) {
@@ -807,6 +811,7 @@ int main(int argc, char *argv[])
case O(MISC,'W'):
case O(MISC, Waitclean):
case O(MISC, DetailPlatform):
+ case O(MISC, KillSubarray):
if (devmode && devmode != opt &&
(devmode == 'E' || (opt == 'E' && devmode != 'Q'))) {
fprintf(stderr, Name ": --examine/-E cannot be given with -%c\n",
@@ -1403,6 +1408,9 @@ int main(int argc, char *argv[])
rv |= Wait(dv->devname); continue;
case Waitclean:
rv |= WaitClean(dv->devname, -1, verbose-quiet); continue;
+ case KillSubarray:
+ rv |= Kill_subarray(dv->devname, subarray, quiet);
+ continue;
}
mdfd = open_mddev(dv->devname, 1);
if (mdfd>=0) {