]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Recent change broken handling of metadata-less arrays.
authorNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:47 +0000 (15:50 +1000)
committerNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:47 +0000 (15:50 +1000)
In particular, failing a device would give a silly
error message.

super0.c
sysfs.c

index 2476d7715998b524eaf474602b2e9b242be4225b..f2d6d63fe062c5d7d79d48362d21551f2a437e90 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -850,7 +850,8 @@ static struct supertype *match_metadata_desc0(char *arg)
        if (strcmp(arg, "0") == 0 ||
            strcmp(arg, "0.90") == 0 ||
            strcmp(arg, "0.91") == 0 ||
-           strcmp(arg, "default") == 0
+           strcmp(arg, "default") == 0 ||
+           strcmp(arg, "") == 0 /* no metadata */
                )
                return st;
 
diff --git a/sysfs.c b/sysfs.c
index 03b09fd84baf849caed42830da12e72775fc7512..d77080b93c2cd1e2387c7dde3008a9c31e90a86f 100644 (file)
--- a/sysfs.c
+++ b/sysfs.c
@@ -103,10 +103,11 @@ struct mdinfo *sysfs_read(int fd, int devnum, unsigned long options)
                strcpy(base, "metadata_version");
                if (load_sys(fname, buf))
                        goto abort;
-               if (strncmp(buf, "none", 4) == 0)
+               if (strncmp(buf, "none", 4) == 0) {
                        sra->array.major_version =
                                sra->array.minor_version = -1;
-               else if (strncmp(buf, "external:", 9) == 0) {
+                       strcpy(sra->text_version, "");
+               } else if (strncmp(buf, "external:", 9) == 0) {
                        sra->array.major_version = -1;
                        sra->array.minor_version = -2;
                        strcpy(sra->text_version, buf+9);