File 1003-mdadm-treat-the-Dell-softraid-array-as-local-array.patch of Package mdadm.30550

From 2361620a9d78a4e26ec438b5cc21fe796d411497 Mon Sep 17 00:00:00 2001
From: Coly Li <colyli@suse.de>
Date: Mon, 31 Aug 2020 00:02:10 +0800
Subject: [PATCH] mdadm: treat the Dell softraid array as local array
Patch-mainline: N/A, in-house usage only as a workaround to Dell's softraid bug
References: bsc#1175004

Dell softraid FW uses homehost in md raid superblock to store
its virtual disk name e.g. "VirtualDisk01". The improper usage
of md raid super block meta data from Dell softraid S150 utility
makes mdadm takes such md raid (Dell softraid Virtual Disk) as
foreign array and won't automatically assemble this array by
default. Here if an array's homehost name starts with "VirtualDisk"
then we take it as a Dell software raid and bypass the set_name
checking. This workaround makes current Dell software raid array
can be treated as local array and start automatically.

This workaround patch will be withdrawn after Dell softraid FW
fixes the improper usage problem on md raid superblock.

Signed-off-by: Coly Li <colyli@suse.de>
---
 super1.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/super1.c b/super1.c
index 7664883..d15067a 100644
--- a/super1.c
+++ b/super1.c
@@ -954,8 +954,25 @@ static int examine_badblocks_super1(struct supertype *st, int fd, char *devname)
 static int match_home1(struct supertype *st, char *homehost)
 {
 	struct mdp_superblock_1 *sb = st->sb;
-	int l = homehost ? strlen(homehost) : 0;
+	char *dell_softraid_header = "VirtualDisk";
+	int l = strlen(dell_softraid_header);
+
+	/*
+	 * Dell softraid FW uses homehost in md raid superblock to store
+	 * its virtual disk name e.g. "VirtualDisk01". The improper usage
+	 * of md raid super block meta data from Dell softraid S150 utility
+	 * makes mdadm takes such md raid (Dell softraid Virtual Disk) as
+	 * foreign array and won't automatically assemble this array by
+	 * default. Here if an array's homehost name starts with "VirtualDisk"
+	 * then we take it as a Dell software raid and bypass the set_name
+	 * checking. This workaround makes current Dell software raid array
+	 * can be treated as local array and start automatically.
+	 */
+	if (strncmp(sb->set_name, dell_softraid_header, l) == 0)
+		return 1;
 
+	/* Normal cases handleing */
+	l = homehost ? strlen(homehost) : 0;
 	return (l > 0 && l < 32 && sb->set_name[l] == ':' &&
 		strncmp(sb->set_name, homehost, l) == 0);
 }
-- 
2.26.2

openSUSE Build Service is sponsored by