Rebuildmap: strip local host name from device name.
When /run/mdadm/map is being rebuilt, e.g. by "mdadm -Ir", if the device doesn't exist in /dev, we have to choose a name. Currently we don't strip the hostname which is wrong if it is the local host. Reported-by: Stephen Kent <smkent@smkent.net> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
36dab45b89
commit
628cdf19ea
13
mapfile.c
13
mapfile.c
|
@ -455,12 +455,19 @@ void RebuildMap(void)
|
||||||
sep = "";
|
sep = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strchr(name, ':'))
|
if (strchr(name, ':')) {
|
||||||
/* probably a uniquifying
|
/* Probably a uniquifying
|
||||||
* hostname prefix. Allow
|
* hostname prefix. Allow
|
||||||
* without a suffix
|
* without a suffix, and strip
|
||||||
|
* hostname if it is us.
|
||||||
*/
|
*/
|
||||||
|
if (homehost && unum == -1 &&
|
||||||
|
strncmp(name, homehost,
|
||||||
|
strlen(homehost)) == 0 &&
|
||||||
|
name[strlen(homehost)] == ':')
|
||||||
|
name += strlen(homehost)+1;
|
||||||
unum = -1;
|
unum = -1;
|
||||||
|
}
|
||||||
|
|
||||||
while (conflict) {
|
while (conflict) {
|
||||||
if (unum >= 0)
|
if (unum >= 0)
|
||||||
|
|
Loading…
Reference in New Issue