All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RESEND] Add metadata signature check for IMSM on 4Kn drives
@ 2016-06-23  8:32 Alexey Obitotskiy
  2016-06-23  9:47 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Obitotskiy @ 2016-06-23  8:32 UTC (permalink / raw)
  To: util-linux; +Cc: kzak

Drives with 512 and 4K sectors have different offset for
metadata signature. Without signature detected on 4Kn drives
those drives will not be recognized as raid member. This
patch adds checking for IMSM signature for 4Kn drives.

Signed-off-by: Alexey Obitotskiy <aleksey.obitotskiy@intel.com>
---
 libblkid/src/superblocks/isw_raid.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/libblkid/src/superblocks/isw_raid.c b/libblkid/src/superblocks/isw_raid.c
index 065c2b2..e9ecf05 100644
--- a/libblkid/src/superblocks/isw_raid.c
+++ b/libblkid/src/superblocks/isw_raid.c
@@ -26,6 +26,14 @@ struct isw_metadata {
 #define ISW_SIGNATURE		"Intel Raid ISM Cfg Sig. "
 
 
+static struct isw_metadata *get_isw_metadata(blkid_probe pr, unsigned int sector_size,
+		uint64_t *off)
+{
+	*off = ((pr->size / sector_size) - 2) * sector_size;
+	return (struct isw_metadata *)blkid_probe_get_buffer(pr,
+			*off, sizeof(struct isw_metadata));
+}
+
 static int probe_iswraid(blkid_probe pr,
 		const struct blkid_idmag *mag __attribute__((__unused__)))
 {
@@ -37,16 +45,19 @@ static int probe_iswraid(blkid_probe pr,
 	if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
 		return 1;
 
-	off = ((pr->size / 0x200) - 2) * 0x200;
-	isw = (struct isw_metadata *)
-			blkid_probe_get_buffer(pr,
-					off,
-					sizeof(struct isw_metadata));
+	isw = get_isw_metadata(pr, 512, &off);
 	if (!isw)
 		return errno ? -errno : 1;
 
-	if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
-		return 1;
+	if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) {
+		isw = get_isw_metadata(pr, 4096, &off);
+		if (!isw)
+			return errno ? -errno : 1;
+
+		if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0)
+			return 1;
+	}
+
 	if (blkid_probe_sprintf_version(pr, "%6s",
 			&isw->sig[sizeof(ISW_SIGNATURE)-1]) != 0)
 		return 1;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][RESEND] Add metadata signature check for IMSM on 4Kn drives
  2016-06-23  8:32 [PATCH][RESEND] Add metadata signature check for IMSM on 4Kn drives Alexey Obitotskiy
@ 2016-06-23  9:47 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2016-06-23  9:47 UTC (permalink / raw)
  To: Alexey Obitotskiy; +Cc: util-linux

On Thu, Jun 23, 2016 at 10:32:16AM +0200, Alexey Obitotskiy wrote:
> Drives with 512 and 4K sectors have different offset for
> metadata signature. Without signature detected on 4Kn drives
> those drives will not be recognized as raid member. This
> patch adds checking for IMSM signature for 4Kn drives.

The patch seems OK, but be patient. I'm currently busy with another
stuff (RHEL). Thanks,

    Karel
-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-23  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-23  8:32 [PATCH][RESEND] Add metadata signature check for IMSM on 4Kn drives Alexey Obitotskiy
2016-06-23  9:47 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.