All of lore.kernel.org
 help / color / mirror / Atom feed
* mdadm: super0: do not override uuid with homehost
@ 2012-10-20 15:40 Michael Tokarev
  2012-10-20 16:09 ` Michael Tokarev
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2012-10-20 15:40 UTC (permalink / raw)
  To: NeilBrown; +Cc: Michael Tokarev, linux RAID, 686703

When --uuid is specified in the command line, even for v0.90
superblock we override last portion of uuid with data from
--homehost, which is wrong (and disagrees with the manpage).
Only use homehost in super0 if no uuid is specified.

Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>

diff --git a/super0.c b/super0.c
index 1375799..ca4c082 100644
--- a/super0.c
+++ b/super0.c
@@ -657,7 +657,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
 		if (rfd >= 0)
 			close(rfd);
 	}
-	if (homehost) {
+	if (homehost && !uuid) {
 		char buf[20];
 		char *hash = sha1_buffer(homehost,
 					 strlen(homehost),

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

* Re: mdadm: super0: do not override uuid with homehost
  2012-10-20 15:40 mdadm: super0: do not override uuid with homehost Michael Tokarev
@ 2012-10-20 16:09 ` Michael Tokarev
  2012-10-21 21:50   ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2012-10-20 16:09 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux RAID

On 20.10.2012 19:40, Michael Tokarev wrote:
> When --uuid is specified in the command line, even for v0.90
> superblock we override last portion of uuid with data from
> --homehost, which is wrong (and disagrees with the manpage).
> Only use homehost in super0 if no uuid is specified.
> 
> Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
> 
> diff --git a/super0.c b/super0.c
> index 1375799..ca4c082 100644
> --- a/super0.c
> +++ b/super0.c
> @@ -657,7 +657,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
>  		if (rfd >= 0)
>  			close(rfd);
>  	}
> -	if (homehost) {
> +	if (homehost && !uuid) {

Besides, do we need to check *homehost here too,
in order to be able to unset homehost given in
config file or whatnot, by setting it to an empty
string?

/mjt


>  		char buf[20];
>  		char *hash = sha1_buffer(homehost,
>  					 strlen(homehost),


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

* Re: mdadm: super0: do not override uuid with homehost
  2012-10-20 16:09 ` Michael Tokarev
@ 2012-10-21 21:50   ` NeilBrown
  0 siblings, 0 replies; 3+ messages in thread
From: NeilBrown @ 2012-10-21 21:50 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: linux RAID

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

On Sat, 20 Oct 2012 20:09:27 +0400 Michael Tokarev <mjt@tls.msk.ru> wrote:

> On 20.10.2012 19:40, Michael Tokarev wrote:
> > When --uuid is specified in the command line, even for v0.90
> > superblock we override last portion of uuid with data from
> > --homehost, which is wrong (and disagrees with the manpage).
> > Only use homehost in super0 if no uuid is specified.
> > 
> > Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
> > 
> > diff --git a/super0.c b/super0.c
> > index 1375799..ca4c082 100644
> > --- a/super0.c
> > +++ b/super0.c
> > @@ -657,7 +657,7 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
> >  		if (rfd >= 0)
> >  			close(rfd);
> >  	}
> > -	if (homehost) {
> > +	if (homehost && !uuid) {
> 
> Besides, do we need to check *homehost here too,
> in order to be able to unset homehost given in
> config file or whatnot, by setting it to an empty
> string?

No we don't.
	if (homehost && (!homehost[0] || strcasecmp(homehost, "<none>") == 0)) {
		homehost = NULL;
		require_homehost = 0;
	}

(from 3.2.x, slightly different in 'master') so if *homehost would be nul,
homehost gets set to NULL.

I've applied your patch as-is.
Thanks,
NeilBrown

> 
> /mjt
> 
> 
> >  		char buf[20];
> >  		char *hash = sha1_buffer(homehost,
> >  					 strlen(homehost),


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

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

end of thread, other threads:[~2012-10-21 21:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 15:40 mdadm: super0: do not override uuid with homehost Michael Tokarev
2012-10-20 16:09 ` Michael Tokarev
2012-10-21 21:50   ` NeilBrown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.