]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: put journal device in right place of --detail
authorSong Liu <songliubraving@fb.com>
Fri, 12 Aug 2016 00:14:13 +0000 (17:14 -0700)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 12 Aug 2016 14:58:58 +0000 (10:58 -0400)
When there is failed HDDs, journal device showed in wrong place
of --detail:

    Number   Major   Minor   RaidDevice State
       4       8       24        -      journal   /dev/sdb8
       1       8       18        1      active sync   /dev/sdb2
       2       8       19        2      active sync   /dev/sdb3
       3       8       21        3      active sync   /dev/sdb5

       0       8       17        -      faulty   /dev/sdb1

This patch fixed the output as:

    Number   Major   Minor   RaidDevice State
       -       0        0        0      removed
       1       8       18        1      active sync   /dev/sdb2
       2       8       19        2      active sync   /dev/sdb3
       3       8       21        3      active sync   /dev/sdb5

       0       8       17        -      faulty   /dev/sdb1
       4       8       24        -      journal   /dev/sdb8

Reported-by: Yi Zhang <yizhan@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Detail.c

index 7a984c83b3fb6fb97bb813586fe95b0b4ebd23de..925e4794c983785698d1648a80d5e6b49fb2d956 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -323,7 +323,8 @@ int Detail(char *dev, struct context *c)
                if (disk.major == 0 && disk.minor == 0)
                        continue;
                if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks
-                   && disks[disk.raid_disk*2].state == (1<<MD_DISK_REMOVED))
+                   && disks[disk.raid_disk*2].state == (1<<MD_DISK_REMOVED)
+                   && ((disk.state & (1<<MD_DISK_JOURNAL)) == 0))
                        disks[disk.raid_disk*2] = disk;
                else if (disk.raid_disk >= 0 && disk.raid_disk < array.raid_disks
                         && disks[disk.raid_disk*2+1].state == (1<<MD_DISK_REMOVED)