summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorMariusz Dabrowski <mariusz.dabrowski@intel.com>2016-09-22 09:02:11 +0200
committerJes Sorensen <Jes.Sorensen@redhat.com>2016-09-22 11:35:02 -0400
commitfa219dd26aa498f3e446798b7b341e8e4a29d378 (patch)
treeee59cf1b472df66a91136749d949097960ab7c11 /util.c
parent676e87a806240b2bf32ad8738c59fe1c3b4b2b5b (diff)
downloadmdadm-fa219dd26aa498f3e446798b7b341e8e4a29d378.tar.gz
Fix RAID metadata check
mdadm recognizes devices with partition table as part of an RAID array and invalid warning message is displayed. After this fix proper warning messages are being displayed for MBR/GPT disks and devices with RAID metadata. Signed-off-by: Mariusz Dabrowski <mariusz.dabrowski@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/util.c b/util.c
index 8b52242..a238a21 100644
--- a/util.c
+++ b/util.c
@@ -710,17 +710,22 @@ int check_raid(int fd, char *name)
if (!st)
return 0;
- st->ss->load_super(st, fd, name);
- /* Looks like a raid array .. */
- pr_err("%s appears to be part of a raid array:\n",
- name);
- st->ss->getinfo_super(st, &info, NULL);
- st->ss->free_super(st);
- crtime = info.array.ctime;
- level = map_num(pers, info.array.level);
- if (!level) level = "-unknown-";
- cont_err("level=%s devices=%d ctime=%s",
- level, info.array.raid_disks, ctime(&crtime));
+ if (st->ss->add_to_super != NULL) {
+ st->ss->load_super(st, fd, name);
+ /* Looks like a raid array .. */
+ pr_err("%s appears to be part of a raid array:\n", name);
+ st->ss->getinfo_super(st, &info, NULL);
+ st->ss->free_super(st);
+ crtime = info.array.ctime;
+ level = map_num(pers, info.array.level);
+ if (!level)
+ level = "-unknown-";
+ cont_err("level=%s devices=%d ctime=%s",
+ level, info.array.raid_disks, ctime(&crtime));
+ } else {
+ /* Looks like GPT or MBR */
+ pr_err("partition table exists on %s\n", name);
+ }
return 1;
}