* mdadm --create vs --update with --homehost <ignore>
[not found] <4325d3bb-a6d8-4d13-95b6-4f29db1a5206.ref@yahoo.ca>
@ 2024-02-11 17:13 ` Earl Chew
2024-02-12 15:19 ` Mariusz Tkaczyk
0 siblings, 1 reply; 2+ messages in thread
From: Earl Chew @ 2024-02-11 17:13 UTC (permalink / raw)
To: linux-raid
Processing of --update blocks removal of homehost from existing arrays even though
new arrays can be created without an embedded homehost.
Is there any concern allowing --update to remove of homehost from existing arrays?
The code for init_super1() shows that when creating a new array, it is possible to exclude homehost:
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/super1.c#n1656
if (homehost &&
strchr(name, ':') == NULL &&
strlen(homehost) + 1 + strlen(name) < 32) {
strcpy(sb->set_name, homehost);
strcat(sb->set_name, ":");
strcat(sb->set_name, name);
} else {
int namelen;
namelen = min((int)strlen(name),
(int)sizeof(sb->set_name) - 1);
memcpy(sb->set_name, name, namelen);
memset(&sb->set_name[namelen], '\0',
sizeof(sb->set_name) - namelen);
}
The code for update_super1() shows that while it is possible to use --update to modify
homehost for an array, it is not possible to remove homehost from an existing array:
https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/super1.c#n1196
if (update == UOPT_HOMEHOST && homehost) {
/*
* Note that 'homehost' is special as it is really
* a "name" update.
*/
char *c;
update = UOPT_NAME;
c = strchr(sb->set_name, ':');
if (c)
snprintf(info->name, sizeof(info->name), "%s", c + 1);
else
snprintf(info->name, sizeof(info->name), "%s",
sb->set_name);
}
Earl
^ permalink raw reply [flat|nested] 2+ messages in thread