linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 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

* Re: mdadm --create vs --update with --homehost <ignore>
  2024-02-11 17:13 ` mdadm --create vs --update with --homehost <ignore> Earl Chew
@ 2024-02-12 15:19   ` Mariusz Tkaczyk
  0 siblings, 0 replies; 2+ messages in thread
From: Mariusz Tkaczyk @ 2024-02-12 15:19 UTC (permalink / raw)
  To: Earl Chew; +Cc: linux-raid

On Sun, 11 Feb 2024 09:13:10 -0800
Earl Chew <earl.chew@yahoo.ca> wrote:

> 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?

I don't see any issue in making it possible so you need to try. I'm also fine
with removing homehost at all but I would like to hear native experienced user
opinion first.

Thanks,
Mariusz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-12 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4325d3bb-a6d8-4d13-95b6-4f29db1a5206.ref@yahoo.ca>
2024-02-11 17:13 ` mdadm --create vs --update with --homehost <ignore> Earl Chew
2024-02-12 15:19   ` Mariusz Tkaczyk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).