]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Don't try to set_array_info when -I find new devices for an array.
authorNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 07:05:02 +0000 (17:05 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 07:05:02 +0000 (17:05 +1000)
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>
Incremental.c

index 6223113c761d102f562c2703a8482a2484b0dc86..c9ba1eafffa3a01041a325acddf5dd65061ad743 100644 (file)
@@ -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++;