diff options
author | NeilBrown <neilb@suse.de> | 2008-09-18 17:05:02 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2008-09-18 17:05:02 +1000 |
commit | 04c0634e8f5bfc9e854b69b0fbbb6e2ad6793010 (patch) | |
tree | 95b83699a5e60bf099f142daa5766dc600d8e60a /Incremental.c | |
parent | 577527957206eafdfe78bd607abed5eafa09c130 (diff) |
Don't try to set_array_info when -I find new devices for an array.
When -I get a new device for a container and tries to incrementally
assemble the container array, it calls sysfs_set_array to create the
array without first checking if it already exists. This produces
unpleasant error messages.
So check first.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Incremental.c')
-rw-r--r-- | Incremental.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Incremental.c b/Incremental.c index 6223113c..c9ba1eaf 100644 --- a/Incremental.c +++ b/Incremental.c @@ -783,7 +783,7 @@ int Incremental_container(struct supertype *st, char *devname, int verbose, } for (ra = list ; ra ; ra = ra->next) { - struct mdinfo *dev; + struct mdinfo *dev, *sra; int devnum = -1; int mdfd; char chosen_name[1024]; @@ -903,8 +903,16 @@ int Incremental_container(struct supertype *st, char *devname, int verbose, return 2; } + sysfs_init(ra, mdfd, 0); - sysfs_set_array(ra, md_get_version(mdfd)); + + sra = sysfs_read(mdfd, 0, GET_VERSION); + if (sra == NULL || strcmp(sra->text_version, ra->text_version) != 0) + if (sysfs_set_array(ra, md_get_version(mdfd)) != 0) + return 1; + if (sra) + sysfs_free(sra); + for (dev = ra->devs; dev; dev = dev->next) if (sysfs_add_disk(ra, dev) == 0) working++; |