summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2011-05-10 12:09:02 +1000
committerNeilBrown <neilb@suse.de>2011-05-10 12:09:02 +1000
commit907ea753259bd515cf24e88bbaab85a742d36bde (patch)
treefac889c171c3a220b03c39ec65d62af5b606c1e0
parent85f102879f02b9e377d19c77670fa7652ebdbe7a (diff)
downloadmdadm-907ea753259bd515cf24e88bbaab85a742d36bde.tar.gz
Grow: restore ability to configure 'faulty' arrays via mdadm.
The big 'grow' refactor lost us the ability to configure 'faulty' arrays through --grow. So put that back as a special case. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Grow.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/Grow.c b/Grow.c
index 41dc9c9..0a08448 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1617,7 +1617,33 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
}
}
- if (array.level == LEVEL_CONTAINER) {
+ if (array.level == LEVEL_FAULTY) {
+ if (level != UnSet && level != array.level) {
+ fprintf(stderr, Name ": cannot change level of Faulty device\n");
+ rv =1 ;
+ }
+ if (chunksize) {
+ fprintf(stderr, Name ": cannot set chunksize of Faulty device\n");
+ rv =1 ;
+ }
+ if (raid_disks && raid_disks != 1) {
+ fprintf(stderr, Name ": cannot set raid_disks of Faulty device\n");
+ rv =1 ;
+ }
+ if (layout_str) {
+ if (ioctl(fd, GET_ARRAY_INFO, &array) != 0) {
+ dprintf("Cannot get array information.\n");
+ goto release;
+ }
+ array.layout = info.new_layout;
+ if (ioctl(fd, SET_ARRAY_INFO, &array) != 0) {
+ fprintf(stderr, Name ": failed to set new layout\n");
+ rv = 1;
+ } else if (!quiet)
+ printf("layout for %s set to %d\n",
+ devname, array.layout);
+ }
+ } else if (array.level == LEVEL_CONTAINER) {
/* This change is to be applied to every array in the
* container. This is only needed when the metadata imposes
* restraints of the various arrays in the container.