Blame SOURCES/0052-imsm-return-correct-uuid-for-volume-in-detail.patch

5d5466
From b771faef931c798a4553db0a8c1366aff90079c6 Mon Sep 17 00:00:00 2001
5d5466
From: Blazej Kucman <blazej.kucman@intel.com>
5d5466
Date: Fri, 29 Nov 2019 15:21:08 +0100
5d5466
Subject: [RHEL8.2 PATCH 52/61] imsm: return correct uuid for volume in detail
5d5466
5d5466
Fixes the side effect of the patch b6180160f ("imsm: save current_vol number")
5d5466
- wrong UUID is printed in detail for each volume.
5d5466
New parameter "subarray" is added to determine what info should be extracted
5d5466
from metadata (subarray or container).
5d5466
The parameter affects only IMSM metadata.
5d5466
5d5466
Signed-off-by: Blazej Kucman <blazej.kucman@intel.com>
5d5466
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
5d5466
---
5d5466
 Detail.c      |  4 ++--
5d5466
 mdadm.h       |  5 +++--
5d5466
 super-ddf.c   |  5 +++--
5d5466
 super-intel.c | 20 ++++++++++++++++++--
5d5466
 super0.c      |  4 ++--
5d5466
 super1.c      |  4 ++--
5d5466
 6 files changed, 30 insertions(+), 12 deletions(-)
5d5466
5d5466
diff --git a/Detail.c b/Detail.c
5d5466
index 3e61e37..24fa462 100644
5d5466
--- a/Detail.c
5d5466
+++ b/Detail.c
5d5466
@@ -623,7 +623,7 @@ This is pretty boring
5d5466
 		free_mdstat(ms);
5d5466
 
5d5466
 		if (st && st->sb)
5d5466
-			st->ss->detail_super(st, c->homehost);
5d5466
+			st->ss->detail_super(st, c->homehost, subarray);
5d5466
 
5d5466
 		if (array.raid_disks == 0 && sra &&
5d5466
 		    sra->array.major_version == -1 &&
5d5466
@@ -767,7 +767,7 @@ skip_devices_state:
5d5466
 	if (spares && c->brief && array.raid_disks)
5d5466
 		printf(" spares=%d", spares);
5d5466
 	if (c->brief && st && st->sb)
5d5466
-		st->ss->brief_detail_super(st);
5d5466
+		st->ss->brief_detail_super(st, subarray);
5d5466
 	if (st)
5d5466
 		st->ss->free_super(st);
5d5466
 
5d5466
diff --git a/mdadm.h b/mdadm.h
5d5466
index c88ceab..91f1338 100644
5d5466
--- a/mdadm.h
5d5466
+++ b/mdadm.h
5d5466
@@ -847,8 +847,9 @@ extern struct superswitch {
5d5466
 	/* Used to report details of an active array.
5d5466
 	 * ->load_super was possibly given a 'component' string.
5d5466
 	 */
5d5466
-	void (*detail_super)(struct supertype *st, char *homehost);
5d5466
-	void (*brief_detail_super)(struct supertype *st);
5d5466
+	void (*detail_super)(struct supertype *st, char *homehost,
5d5466
+			     char *subarray);
5d5466
+	void (*brief_detail_super)(struct supertype *st, char *subarray);
5d5466
 	void (*export_detail_super)(struct supertype *st);
5d5466
 
5d5466
 	/* Optional: platform hardware / firmware details */
5d5466
diff --git a/super-ddf.c b/super-ddf.c
5d5466
index c095e8a..7802063 100644
5d5466
--- a/super-ddf.c
5d5466
+++ b/super-ddf.c
5d5466
@@ -1730,7 +1730,8 @@ err:
5d5466
 	return 1;
5d5466
 }
5d5466
 
5d5466
-static void detail_super_ddf(struct supertype *st, char *homehost)
5d5466
+static void detail_super_ddf(struct supertype *st, char *homehost,
5d5466
+			     char *subarray)
5d5466
 {
5d5466
 	struct ddf_super *sb = st->sb;
5d5466
 	int cnt = be16_to_cpu(sb->virt->populated_vdes);
5d5466
@@ -1787,7 +1788,7 @@ static void uuid_of_ddf_subarray(const struct ddf_super *ddf,
5d5466
 	memcpy(uuid, sha, 4*4);
5d5466
 }
5d5466
 
5d5466
-static void brief_detail_super_ddf(struct supertype *st)
5d5466
+static void brief_detail_super_ddf(struct supertype *st, char *subarray)
5d5466
 {
5d5466
 	struct mdinfo info;
5d5466
 	char nbuf[64];
5d5466
diff --git a/super-intel.c b/super-intel.c
5d5466
index a7fbed4..86dcb69 100644
5d5466
--- a/super-intel.c
5d5466
+++ b/super-intel.c
5d5466
@@ -2183,23 +2183,39 @@ err:
5d5466
 	return 1;
5d5466
 }
5d5466
 
5d5466
-static void detail_super_imsm(struct supertype *st, char *homehost)
5d5466
+static void detail_super_imsm(struct supertype *st, char *homehost,
5d5466
+			      char *subarray)
5d5466
 {
5d5466
 	struct mdinfo info;
5d5466
 	char nbuf[64];
5d5466
+	struct intel_super *super = st->sb;
5d5466
+	int temp_vol = super->current_vol;
5d5466
+
5d5466
+	if (subarray)
5d5466
+		super->current_vol = strtoul(subarray, NULL, 10);
5d5466
 
5d5466
 	getinfo_super_imsm(st, &info, NULL);
5d5466
 	fname_from_uuid(st, &info, nbuf, ':');
5d5466
 	printf("\n              UUID : %s\n", nbuf + 5);
5d5466
+
5d5466
+	super->current_vol = temp_vol;
5d5466
 }
5d5466
 
5d5466
-static void brief_detail_super_imsm(struct supertype *st)
5d5466
+static void brief_detail_super_imsm(struct supertype *st, char *subarray)
5d5466
 {
5d5466
 	struct mdinfo info;
5d5466
 	char nbuf[64];
5d5466
+	struct intel_super *super = st->sb;
5d5466
+	int temp_vol = super->current_vol;
5d5466
+
5d5466
+	if (subarray)
5d5466
+		super->current_vol = strtoul(subarray, NULL, 10);
5d5466
+
5d5466
 	getinfo_super_imsm(st, &info, NULL);
5d5466
 	fname_from_uuid(st, &info, nbuf, ':');
5d5466
 	printf(" UUID=%s", nbuf + 5);
5d5466
+
5d5466
+	super->current_vol = temp_vol;
5d5466
 }
5d5466
 
5d5466
 static int imsm_read_serial(int fd, char *devname, __u8 *serial);
5d5466
diff --git a/super0.c b/super0.c
5d5466
index 42989b9..6b7c0e3 100644
5d5466
--- a/super0.c
5d5466
+++ b/super0.c
5d5466
@@ -348,7 +348,7 @@ err:
5d5466
 	return 1;
5d5466
 }
5d5466
 
5d5466
-static void detail_super0(struct supertype *st, char *homehost)
5d5466
+static void detail_super0(struct supertype *st, char *homehost, char *subarray)
5d5466
 {
5d5466
 	mdp_super_t *sb = st->sb;
5d5466
 	printf("              UUID : ");
5d5466
@@ -368,7 +368,7 @@ static void detail_super0(struct supertype *st, char *homehost)
5d5466
 	printf("\n            Events : %d.%d\n\n", sb->events_hi, sb->events_lo);
5d5466
 }
5d5466
 
5d5466
-static void brief_detail_super0(struct supertype *st)
5d5466
+static void brief_detail_super0(struct supertype *st, char *subarray)
5d5466
 {
5d5466
 	mdp_super_t *sb = st->sb;
5d5466
 	printf(" UUID=");
5d5466
diff --git a/super1.c b/super1.c
5d5466
index b85dc20..929466d 100644
5d5466
--- a/super1.c
5d5466
+++ b/super1.c
5d5466
@@ -833,7 +833,7 @@ err:
5d5466
 	return 1;
5d5466
 }
5d5466
 
5d5466
-static void detail_super1(struct supertype *st, char *homehost)
5d5466
+static void detail_super1(struct supertype *st, char *homehost, char *subarray)
5d5466
 {
5d5466
 	struct mdp_superblock_1 *sb = st->sb;
5d5466
 	bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
5d5466
@@ -857,7 +857,7 @@ static void detail_super1(struct supertype *st, char *homehost)
5d5466
 	       (unsigned long long)__le64_to_cpu(sb->events));
5d5466
 }
5d5466
 
5d5466
-static void brief_detail_super1(struct supertype *st)
5d5466
+static void brief_detail_super1(struct supertype *st, char *subarray)
5d5466
 {
5d5466
 	struct mdp_superblock_1 *sb = st->sb;
5d5466
 	int i;
5d5466
-- 
5d5466
2.7.5
5d5466