]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Assemble.c
Create.c: fix uclibc build
[thirdparty/mdadm.git] / Assemble.c
index 61e8cd17e33265ade0de725b2f28b5c3015682cf..f6c5b99e25e246ee5a833f2fa0c6f25f41c4d669 100644 (file)
@@ -428,8 +428,6 @@ static int select_devices(struct mddev_dev *devlist,
 
                        /* make sure we finished the loop */
                        tmpdev = NULL;
-                       free(st);
-                       st = NULL;
                        goto loop;
                } else {
                        content = *contentp;
@@ -1808,12 +1806,6 @@ try_again:
                                               i, mddev, devices[j].devname);
                        }
                }
-#if 0
-               if (!(super.disks[i].i.disk.state & (1 << MD_DISK_FAULTY))) {
-                       pr_err("devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-                              i, mddev);
-               }
-#endif
        }
        if (c->force && !clean && !is_container(content->array.level) &&
            !enough(content->array.level, content->array.raid_disks,
@@ -1992,13 +1984,11 @@ int assemble_container_content(struct supertype *st, int mdfd,
                return 1;
        }
 
-       if (strcmp(sra->text_version, content->text_version) != 0) {
-               if (content->array.major_version == -1 &&
-                   content->array.minor_version == -2 &&
-                   c->readonly &&
-                   content->text_version[0] == '/')
-                       content->text_version[0] = '-';
-               if (sysfs_set_array(content, 9003) != 0) {
+       /* Fill sysfs properties only if they are not set. Determine it by checking text_version
+        * and ignoring special character on the first place.
+        */
+       if (strcmp(sra->text_version + 1, content->text_version + 1) != 0) {
+               if (sysfs_set_array(content) != 0) {
                        sysfs_free(sra);
                        return 1;
                }
@@ -2025,8 +2015,7 @@ int assemble_container_content(struct supertype *st, int mdfd,
                if (dev)
                        continue;
                /* Don't want this one any more */
-               if (sysfs_set_str(sra, dev2, "slot", "none") < 0 &&
-                   errno == EBUSY) {
+               if (sysfs_set_str(sra, dev2, "slot", STR_COMMON_NONE) < 0 && errno == EBUSY) {
                        pr_err("Cannot remove old device %s: not updating %s\n", dev2->sys_name, sra->sys_name);
                        sysfs_free(sra);
                        return 1;