summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-04-09 09:18:53 +1000
committerNeilBrown <neilb@suse.de>2010-04-09 09:19:19 +1000
commit0f9ce65ed03f69c50ca506c2ef68d739db722971 (patch)
tree2f16c2b6d64b0857e6b31b5f44ac42f45ca8622f /mdadm.c
parent7a5090d2247936d7cf7d9067c960317ad009940d (diff)
downloadmdadm-0f9ce65ed03f69c50ca506c2ef68d739db722971.tar.gz
mdadm-0f9ce65ed03f69c50ca506c2ef68d739db722971.tar.xz
mdadm-0f9ce65ed03f69c50ca506c2ef68d739db722971.zip
Add -fail support to --incremental
This can be used for hot-unplug. When a device has been remove, udev can call mdadm --incremental --fail sda and mdadm will find the array holding sda and remove sda from the array. Based on code from Doug Ledford <dledford@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/mdadm.c b/mdadm.c
index d5e34c0..6690546 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -774,6 +774,9 @@ int main(int argc, char *argv[])
devmode = 'r';
continue;
case O(MANAGE,'f'): /* set faulty */
+ case O(INCREMENTAL,'f'): /* r for incremental is taken, use f
+ * even though we will both fail and
+ * remove the device */
devmode = 'f';
continue;
case O(INCREMENTAL,'R'):
@@ -1517,6 +1520,11 @@ int main(int argc, char *argv[])
": --incremental --scan meaningless without --run.\n");
break;
}
+ if (devmode == 'f') {
+ fprintf(stderr, Name
+ ": --incremental --scan --fail not supported.\n");
+ break;
+ }
rv = IncrementalScan(verbose);
}
if (!devlist) {
@@ -1533,6 +1541,10 @@ int main(int argc, char *argv[])
rv = 1;
break;
}
+ if (devmode == 'f') {
+ rv = IncrementalRemove(devlist->devname, verbose-quiet);
+ break;
+ }
rv = Incremental(devlist->devname, verbose-quiet, runstop,
ss, homehost, require_homehost, autof);
break;