From: NeilBrown Date: Thu, 18 Sep 2008 07:05:02 +0000 (+1000) Subject: Don't try to set_array_info when -I find new devices for an array. X-Git-Tag: mdadm-3.0-devel1~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04c0634e8f5bfc9e854b69b0fbbb6e2ad6793010;p=thirdparty%2Fmdadm.git 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 --- 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++;