summaryrefslogtreecommitdiffstats
path: root/super-ddf.c
diff options
context:
space:
mode:
authorMartin Wilck <mwilck@arcor.de>2013-07-30 23:18:28 +0200
committerNeilBrown <neilb@suse.de>2013-07-31 04:47:44 +0200
commit0e5fa86239cfa4cb5fbdbf46c14ddcb58708efc4 (patch)
tree418950b1d3cf653023ce6335ffea49408e15abf9 /super-ddf.c
parentDDF: ddf_process_update: log offsets for conf changes (diff)
downloadmdadm-0e5fa86239cfa4cb5fbdbf46c14ddcb58708efc4.tar.xz
mdadm-0e5fa86239cfa4cb5fbdbf46c14ddcb58708efc4.zip
DDF: load_ddf_header: more error logging
Try to determine problem if load_ddf_header fails. May be useful for determining compatibility problems with Fake RAID BIOSes. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super-ddf.c')
-rw-r--r--super-ddf.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/super-ddf.c b/super-ddf.c
index b639f07f..f55cc11b 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -754,18 +754,24 @@ static int load_ddf_header(int fd, unsigned long long lba,
if (read(fd, hdr, 512) != 512)
return 0;
- if (!be32_eq(hdr->magic, DDF_HEADER_MAGIC))
+ if (!be32_eq(hdr->magic, DDF_HEADER_MAGIC)) {
+ pr_err("%s: bad header magic\n", __func__);
return 0;
- if (!be32_eq(calc_crc(hdr, 512), hdr->crc))
+ }
+ if (!be32_eq(calc_crc(hdr, 512), hdr->crc)) {
+ pr_err("%s: bad CRC\n", __func__);
return 0;
+ }
if (memcmp(anchor->guid, hdr->guid, DDF_GUID_LEN) != 0 ||
memcmp(anchor->revision, hdr->revision, 8) != 0 ||
!be64_eq(anchor->primary_lba, hdr->primary_lba) ||
!be64_eq(anchor->secondary_lba, hdr->secondary_lba) ||
hdr->type != type ||
memcmp(anchor->pad2, hdr->pad2, 512 -
- offsetof(struct ddf_header, pad2)) != 0)
+ offsetof(struct ddf_header, pad2)) != 0) {
+ pr_err("%s: header mismatch\n", __func__);
return 0;
+ }
/* Looks good enough to me... */
return 1;