]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Query: allow member of non-0.90 arrays to be better reported.
authorNeilBrown <neilb@suse.de>
Thu, 25 Oct 2012 05:38:11 +0000 (16:38 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 25 Oct 2012 05:38:11 +0000 (16:38 +1100)
Currently if a member of a 1.x array is queried, mdadm will
fail to find the name of the active md array if there is one.

Change the lookup to use the mapfile - now it works.

Signed-off-by: NeilBrown <neilb@suse.de>
Query.c

diff --git a/Query.c b/Query.c
index a63a442725e3116f84e19fbc9f6ed5eb8d17dbaa..a709821eb7c7c949cfd227cce37e1010a87542d2 100644 (file)
--- a/Query.c
+++ b/Query.c
@@ -89,9 +89,13 @@ int Query(char *dev)
        close(fd);
        if (superror == 0) {
                /* array might be active... */
+               int uuid[4];
+               struct map_ent *me, *map = NULL;
                st->ss->getinfo_super(st, &info, NULL);
-               if (st->ss == &super0) {
-                       mddev = get_md_name(info.array.md_minor);
+               st->ss->uuid_from_super(st, uuid);
+               me = map_by_uuid(&map, uuid);
+               if (me) {
+                       mddev = me->path;
                        disc.number = info.disk.number;
                        activity = "undetected";
                        if (mddev && (fd = open(mddev, O_RDONLY))>=0) {
@@ -106,7 +110,7 @@ int Query(char *dev)
                                close(fd);
                        }
                } else {
-                       activity = "unknown";
+                       activity = "inactive";
                        mddev = "array";
                }
                printf("%s: device %d in %d device %s %s %s.  Use mdadm --examine for more detail.\n",