From 04c0634e8f5bfc9e854b69b0fbbb6e2ad6793010 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Thu, 18 Sep 2008 17:05:02 +1000 Subject: [PATCH] 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 --- Incremental.c | 12 ++++++++++-- 1 file 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++; -- 2.47.2