linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Stephen Kent <smkent@smkent.net>
Cc: linux RAID <linux-raid@vger.kernel.org>
Subject: Re: mdadm named array (metadata 1.2) and udev when assembling an array in initramfs
Date: Mon, 3 Nov 2014 12:50:20 +1100	[thread overview]
Message-ID: <20141103125020.19308fd5@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 1343 bytes --]


Hi Stephen,
 thanks for the bug report.
This patch should fix it.

NeilBrown

From 628cdf19ea35daad22e409e51c0abc7ffb19d6aa Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 3 Nov 2014 12:49:05 +1100
Subject: [PATCH] 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>

diff --git a/mapfile.c b/mapfile.c
index 4e7f24214b8a..41599df05f97 100644
--- a/mapfile.c
+++ b/mapfile.c
@@ -455,12 +455,19 @@ void RebuildMap(void)
 							sep = "";
 						}
 					}
-					if (strchr(name, ':'))
-						/* probably a uniquifying
+					if (strchr(name, ':')) {
+						/* Probably a uniquifying
 						 * 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;
+					}
 
 					while (conflict) {
 						if (unum >= 0)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

             reply	other threads:[~2014-11-03  1:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-03  1:50 NeilBrown [this message]
2014-11-03  4:16 ` mdadm named array (metadata 1.2) and udev when assembling an array in initramfs Stephen Kent
2014-11-03  5:43   ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2014-11-01 18:53 Stephen Kent
2014-11-04  9:06 ` Michael Tokarev
2014-11-04 18:17   ` Stephen Kent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141103125020.19308fd5@notabene.brown \
    --to=neilb@suse.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=smkent@smkent.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).