Skip to contentSkip to conversation

super1: remove support for name= in config

PATCH In review Mariusz Tkaczyk 1 participant 2 messages Feb 1, 2024 – Feb 9, 2024 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 super1: remove support for name= in config

Only super1 provides "name=" to config. It is recoreded in metadata so there is no need to duplicate same information.
UUID is our main key.

It is not used by Incremental and Assemble handles empty name well because other supertypes don't set it in conf.

Expectation that the name in config is same as in metadata is bug prone. Config should be the place where use can define customized settings.

Remove printing "name=" from mdadm config creation commands. Ignore the name in config file to keep backward compatibility. Remove description from man mdadm.conf.

Update 00conftest because "name" is no longer accepted. As the name is ignored, error for mdadm --detail is not printed.

Fixes e2eb503bd797 ("mdadm: Follow POSIX Portable Character Set")
---
 config.c                       | 12 ++----
 mdadm.conf.5.in                |  7 ---
 super1.c                       |  8 ----
 tests/00confnames              | 79 ++++++----------------------------
 tests/templates/names_template |  7 +--
 5 files changed, 19 insertions(+), 94 deletions(-)
config.c +4 -8
index 9a04cae85f52..44f7dd2f316a 100644
@@ -262,6 +262,7 @@ pass:
  * @cmdline: context dependent actions.
  *
  * If criteria passed, set name in @ident.
+ * Note: name is not used by config file, it for cmdline only.
  *
  * Return: %MDADM_STATUS_SUCCESS or %MDADM_STATUS_ERROR.
  */
@@ -571,7 +572,8 @@ void arrayline(char *line)
 					mis.super_minor = minor;
 			}
 		} else if (strncasecmp(w, "name=", 5) == 0) {
-			_ident_set_name(&mis, w + 5, false);
+			/* Ignore name in confile */
+			continue;
 		} else if (strncasecmp(w, "bitmap=", 7) == 0) {
 			if (mis.bitmap_file)
 				pr_err("only specify bitmap file once. %s ignored\n",
@@ -1279,13 +1281,7 @@ struct mddev_ident *conf_match(struct supertype *st,
 				       array_list->devname);
 			continue;
 		}
-		if (array_list->name[0] &&
-		    strcasecmp(array_list->name, info->name) != 0) {
-			if (verbose >= 2 && array_list->devname)
-				pr_err("Name differs from %s.\n",
-				       array_list->devname);
-			continue;
-		}
+
 		if (array_list->devices && devname &&
 		    !match_oneof(array_list->devices, devname)) {
 			if (verbose >= 2 && array_list->devname)
mdadm.conf.5.in +0 -7
index 94e23dd013ba..787e51e9e88d 100644
@@ -133,13 +133,6 @@ The value should be a 128 bit uuid in hexadecimal, with punctuation
 interspersed if desired.  This must match the uuid stored in the
 superblock.
 .TP
-.B name=
-The value should be a simple textual name as was given to
-.I mdadm
-when the array was created.  This must match the name stored in the
-superblock on a device for that device to be included in the array.
-Not all superblock formats support names.
-.TP
 .B super\-minor=
 The value is an integer which indicates the minor number that was
 stored in the superblock when the array was created. When an array is
super1.c +0 -8
index dfde4629508b..5fd2228efbd6 100644
@@ -645,10 +645,6 @@ static void brief_examine_super1(struct supertype *st, int verbose)
 			printf(":");
 		printf("%02x", sb->set_uuid[i]);
 	}
-	if (sb->set_name[0]) {
-		printf(" name=");
-		print_quoted(sb->set_name);
-	}
 	printf("\n");
 }
 
@@ -875,10 +871,6 @@ static void brief_detail_super1(struct supertype *st, char *subarray)
 	struct mdp_superblock_1 *sb = st->sb;
 	int i;
 
-	if (sb->set_name[0]) {
-		printf(" name=");
-		print_quoted(sb->set_name);
-	}
 	printf(" UUID=");
 	for (i = 0; i < 16; i++) {
 		if ((i & 3) == 0 && i != 0)
tests/00confnames +14 -65

120 lines not on this page · raw message

tests/templates/names_template +1 -6
index 6181bfaaaa1a..1b6cd14bf51d 100644
@@ -63,8 +63,7 @@ function names_verify() {
 names_make_conf() {
 	local UUID="$1"
 	local WANTED_DEVNAME="$2"
-	local WANTED_NAME="$3"
-	local CONF="$4"
+	local CONF="$3"
 
 	local LINE="ARRAY metadata=1.2 UUID=$UUID"
 
@@ -72,9 +71,5 @@ names_make_conf() {
 		LINE="$LINE $WANTED_DEVNAME"
 	fi
 
-	if [[ "$WANTED_NAME" != "empty" ]]; then
-		LINE="$LINE name=$WANTED_NAME"
-	fi
-
 	echo $LINE > $CONF
 }
Signature · 1 line
2.35.3
#1 lore raw
Quoted 14 lines · On Thu, 1 Feb 2024 12:32:41 +0100 Mariusz Tkaczyk…

Only super1 provides "name=" to config. It is recoreded in metadata so there is no need to duplicate same information.
UUID is our main key.

It is not used by Incremental and Assemble handles empty name well because other supertypes don't set it in conf.

Expectation that the name in config is same as in metadata is bug prone. Config should be the place where use can define customized settings.

Remove printing "name=" from mdadm config creation commands. Ignore the name in config file to keep backward compatibility. Remove description from man mdadm.conf.

Quoted 6 lines

Update 00conftest because "name" is no longer accepted. As the name is ignored, error for mdadm --detail is not printed.

Fixes e2eb503bd797 ("mdadm: Follow POSIX Portable Character Set")

No comments, Applied!

Thanks,
Mariusz