public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] mdadm/imsm: use creation_time for ctime in container info
@ 2026-02-04 14:00 Xiao Ni
  0 siblings, 0 replies; only message in thread
From: Xiao Ni @ 2026-02-04 14:00 UTC (permalink / raw)
  To: mtkaczyk; +Cc: linux-raid

When a disk has both DDF and IMSM metadata (e.g., migrated from DDF
to IMSM or has remnant DDF metadata), guess_super_type() selects the
metadata with the later creation time. Previously, IMSM always
returned ctime=0 in getinfo_super_imsm(), causing it to lose to DDF
which extracts a real timestamp from its GUID.

This resulted in the wrong metadata being selected during assembly,
leading to boot failures when LVM activated raw PVs instead of MD
devices.

Fix this by extracting the actual creation time from the IMSM
metadata structure (mpb->creation_time) instead of hardcoding 0.
This ensures that when both metadata types are present, the more
recent one is correctly selected.

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 super-intel.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index e9fce12c35c7..2ff9d4862f7f 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3826,11 +3826,13 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
 	/* Set raid_disks to zero so that Assemble will always pull in valid
 	 * spares
 	 */
+	mpb = super->anchor;
+
 	info->array.raid_disks    = 0;
 	info->array.level         = LEVEL_CONTAINER;
 	info->array.layout        = 0;
 	info->array.md_minor      = -1;
-	info->array.ctime         = 0; /* N/A for imsm */
+	info->array.ctime         = __le64_to_cpu(mpb->creation_time);
 	info->array.utime         = 0;
 	info->array.chunk_size    = 0;
 
@@ -3850,7 +3852,6 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
 	info->bb.supported = 1;
 
 	/* do we have the all the insync disks that we expect? */
-	mpb = super->anchor;
 	info->events = __le32_to_cpu(mpb->generation_num);
 
 	for (i = 0; i < mpb->num_raid_devs; i++) {
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-04 14:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-04 14:00 [PATCH 1/1] mdadm/imsm: use creation_time for ctime in container info Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox