dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0037-mdadm-force-a-uuid-swap-on-big-endian.patch

f5dd7b
From 2c2d9c48d2daf0d78d20494c3779c0f6dc4bfa75 Mon Sep 17 00:00:00 2001
f5dd7b
From: Nigel Croxon <ncroxon@redhat.com>
f5dd7b
Date: Tue, 24 Sep 2019 11:39:24 -0400
f5dd7b
Subject: [RHEL7.8 PATCH V2 37/47] mdadm: force a uuid swap on big endian
f5dd7b
f5dd7b
The code path for metadata 0.90 calls a common routine
f5dd7b
fname_from_uuid that uses metadata 1.2. The code expects member
f5dd7b
swapuuid to be setup and usable. But it is only setup when using
f5dd7b
metadata 1.2. Since the metadata 0.90 did not create swapuuid
f5dd7b
and set it. The test (st->ss == &super1) ? 1 : st->ss->swapuuid
f5dd7b
fails. The swapuuid is set at compile time based on byte order.
f5dd7b
Any call based on metadata 0.90 and on big endian processors,
f5dd7b
the --export uuid will be incorrect.
f5dd7b
f5dd7b
Signed-Off-by: Nigel Croxon <ncroxon@redhat.com>
f5dd7b
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
f5dd7b
---
f5dd7b
 util.c | 4 ++++
f5dd7b
 1 file changed, 4 insertions(+)
f5dd7b
f5dd7b
diff --git a/util.c b/util.c
f5dd7b
index c26cf5f..64dd409 100644
f5dd7b
--- a/util.c
f5dd7b
+++ b/util.c
f5dd7b
@@ -685,8 +685,12 @@ char *fname_from_uuid(struct supertype *st, struct mdinfo *info,
f5dd7b
 	// work, but can't have it set if we want this printout to match
f5dd7b
 	// all the other uuid printouts in super1.c, so we force swapuuid
f5dd7b
 	// to 1 to make our printout match the rest of super1
f5dd7b
+#if __BYTE_ORDER == BIG_ENDIAN
f5dd7b
+	return __fname_from_uuid(info->uuid, 1, buf, sep);
f5dd7b
+#else
f5dd7b
 	return __fname_from_uuid(info->uuid, (st->ss == &super1) ? 1 :
f5dd7b
 				 st->ss->swapuuid, buf, sep);
f5dd7b
+#endif
f5dd7b
 }
f5dd7b
 
f5dd7b
 int check_ext2(int fd, char *name)
f5dd7b
-- 
f5dd7b
2.7.5
f5dd7b