dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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