On 7/18/19 10:03 AM, Nigel Croxon wrote:
The problem is:
"mdadm --detail" and "mdadm --detail --export" report two different
UUIDs for one array, and this happens only on s390x.
The code path for metadata 0.90 calls a common routine fname_from_uuid
that uses metadata 1.2 (&super1).
The code expects member swapuuid to be setup and usable. But it is
only setup when using metadata 1.2.
Since the metadata 0.90 did not create swapuuid and set it.
The test (st->ss == &super1) ? 1 : st->ss->swapuuid fails.
The swapuuid is set at compile time based on byte order, for super1 only.
Any call based on metadata 0.90 and on big endian processors, the
--export uuid will be incorrect.
I looked at adding .swapuuid to the end of the list in superswitch
super0 (super0.c). But then
in the routine fname_from_uuid (util.c), one would have to figure out
which metadata is being
used to then use the right address of super0 or super1.
An alternative is the patch below.
-Nigel
---
util.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/util.c b/util.c
index c26cf5f..64dd409 100644
--- a/util.c
+++ b/util.c
@@ -685,8 +685,12 @@ char *fname_from_uuid(struct supertype *st,
struct mdinfo *info,
// work, but can't have it set if we want this printout to match
// all the other uuid printouts in super1.c, so we force swapuuid
// to 1 to make our printout match the rest of super1
+#if __BYTE_ORDER == BIG_ENDIAN
+ return __fname_from_uuid(info->uuid, 1, buf, sep);
+#else
return __fname_from_uuid(info->uuid, (st->ss == &super1) ? 1 :
st->ss->swapuuid, buf, sep);
+#endif
}
int check_ext2(int fd, char *name)
Has anyone another solution then my proposed patch?
-Nigel