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