mdadm --create vs --update with --homehost <ignore>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux