|
|
64664a |
From 2181ce4a5726c4c72e68e6964b7ef7442e507707 Mon Sep 17 00:00:00 2001
|
|
|
64664a |
From: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
|
|
64664a |
Date: Fri, 24 Jun 2016 11:59:35 +0200
|
|
|
64664a |
Subject: [PATCH] libblkid: Add metadata signature check for IMSM on 4Kn drives
|
|
|
64664a |
|
|
|
64664a |
Drives with 512 and 4K sectors have different offset for
|
|
|
64664a |
metadata signature. Without signature detected on 4Kn drives
|
|
|
64664a |
those drives will not be recognized as raid member. This
|
|
|
64664a |
patch adds checking for IMSM signature for 4Kn drives.
|
|
|
64664a |
|
|
|
64664a |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1451704
|
|
|
64664a |
Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
|
|
|
64664a |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
64664a |
---
|
|
|
64664a |
libblkid/src/superblocks/isw_raid.c | 13 +++++++------
|
|
|
64664a |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
|
64664a |
|
|
|
64664a |
diff --git a/libblkid/src/superblocks/isw_raid.c b/libblkid/src/superblocks/isw_raid.c
|
|
|
64664a |
index 065c2b2..81d53a1 100644
|
|
|
64664a |
--- a/libblkid/src/superblocks/isw_raid.c
|
|
|
64664a |
+++ b/libblkid/src/superblocks/isw_raid.c
|
|
|
64664a |
@@ -25,11 +25,11 @@ struct isw_metadata {
|
|
|
64664a |
|
|
|
64664a |
#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. "
|
|
|
64664a |
|
|
|
64664a |
-
|
|
|
64664a |
static int probe_iswraid(blkid_probe pr,
|
|
|
64664a |
const struct blkid_idmag *mag __attribute__((__unused__)))
|
|
|
64664a |
{
|
|
|
64664a |
uint64_t off;
|
|
|
64664a |
+ unsigned int sector_size;
|
|
|
64664a |
struct isw_metadata *isw;
|
|
|
64664a |
|
|
|
64664a |
if (pr->size < 0x10000)
|
|
|
64664a |
@@ -37,16 +37,17 @@ static int probe_iswraid(blkid_probe pr,
|
|
|
64664a |
if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
|
|
|
64664a |
return 1;
|
|
|
64664a |
|
|
|
64664a |
- off = ((pr->size / 0x200) - 2) * 0x200;
|
|
|
64664a |
- isw = (struct isw_metadata *)
|
|
|
64664a |
- blkid_probe_get_buffer(pr,
|
|
|
64664a |
- off,
|
|
|
64664a |
- sizeof(struct isw_metadata));
|
|
|
64664a |
+ sector_size = blkid_probe_get_sectorsize(pr);
|
|
|
64664a |
+ off = ((pr->size / sector_size) - 2) * sector_size;
|
|
|
64664a |
+
|
|
|
64664a |
+ isw = (struct isw_metadata *)blkid_probe_get_buffer(pr,
|
|
|
64664a |
+ off, sizeof(struct isw_metadata));
|
|
|
64664a |
if (!isw)
|
|
|
64664a |
return errno ? -errno : 1;
|
|
|
64664a |
|
|
|
64664a |
if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
|
|
|
64664a |
return 1;
|
|
|
64664a |
+
|
|
|
64664a |
if (blkid_probe_sprintf_version(pr, "%6s",
|
|
|
64664a |
&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
|
|
|
64664a |
return 1;
|
|
|
64664a |
--
|
|
|
64664a |
2.9.4
|
|
|
64664a |
|