summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-11-06 17:26:47 +1100
committerNeilBrown <neilb@suse.de>2009-11-06 17:26:47 +1100
commit9ce510be9c71bae002a3b68ad138b164c908150a (patch)
tree9101397388c651cf7199068437ea41d1e405c40a /mdadm.c
parentb5ea446ae7c5548b9f3d88a474dc641a6910ddaf (diff)
downloadmdadm-9ce510be9c71bae002a3b68ad138b164c908150a.tar.gz
mdadm-9ce510be9c71bae002a3b68ad138b164c908150a.tar.xz
mdadm-9ce510be9c71bae002a3b68ad138b164c908150a.zip
Grow: do not allow size changes with other changes.
A change the reduces the size of an array always happens before any other change. So it can cause data to be lost. By themselves these changes are reversible. But once another change has started, the data would be permanently lost. So recommend data integrity be checked between a size change and any other change. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mdadm.c b/mdadm.c
index 0c51d63..3dc8be9 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -1417,9 +1417,18 @@ int main(int argc, char *argv[])
if (array_size >= 0) {
/* alway impose array size first, independent of
* anything else
+ * Do not allow level or raid_disks changes at the
+ * same time as that can be irreversibly destructive.
*/
struct mdinfo sra;
int err;
+ if (raiddisks || level != UnSet) {
+ fprintf(stderr, Name ": cannot change array size in same operation "
+ "as changing raiddisks or level.\n"
+ " Change size first, then check that data is still intact.\n");
+ rv = 1;
+ break;
+ }
sysfs_init(&sra, mdfd, 0);
if (array_size == 0)
err = sysfs_set_str(&sra, NULL, "array_size", "default");