linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Print correct md device name if write_init_super fails
@ 2012-02-21 12:30 Jes.Sorensen
  2012-02-21 19:53 ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Jes.Sorensen @ 2012-02-21 12:30 UTC (permalink / raw)
  To: neilb; +Cc: meyering, linux-raid

From: Jes Sorensen <Jes.Sorensen@redhat.com>

This avoids a segfault in case one tries to create a raid from a non
existing device (like a loop device).

Reported by Jim Meyering in
https://bugzilla.redhat.com/show_bug.cgi?id=795461

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 Create.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Create.c b/Create.c
index 90ff3ed..702ac34 100644
--- a/Create.c
+++ b/Create.c
@@ -926,7 +926,7 @@ int Create(struct supertype *st, char *mddev,
 			if (st->ss->write_init_super(st)) {
 				fprintf(stderr,
 					Name ": Failed to write metadata to %s\n",
-					dv->devname);
+					mddev);
 				st->ss->free_super(st);
 				goto abort_locked;
 			}
-- 
1.7.7.6


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

* Re: [PATCH] Print correct md device name if write_init_super fails
  2012-02-21 12:30 [PATCH] Print correct md device name if write_init_super fails Jes.Sorensen
@ 2012-02-21 19:53 ` NeilBrown
  2012-02-22 11:00   ` Jes Sorensen
  0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-02-21 19:53 UTC (permalink / raw)
  To: Jes.Sorensen; +Cc: meyering, linux-raid

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

On Tue, 21 Feb 2012 13:30:02 +0100 Jes.Sorensen@redhat.com wrote:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> 
> This avoids a segfault in case one tries to create a raid from a non
> existing device (like a loop device).
> 
> Reported by Jim Meyering in
> https://bugzilla.redhat.com/show_bug.cgi?id=795461
> 
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  Create.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/Create.c b/Create.c
> index 90ff3ed..702ac34 100644
> --- a/Create.c
> +++ b/Create.c
> @@ -926,7 +926,7 @@ int Create(struct supertype *st, char *mddev,
>  			if (st->ss->write_init_super(st)) {
>  				fprintf(stderr,
>  					Name ": Failed to write metadata to %s\n",
> -					dv->devname);
> +					mddev);
>  				st->ss->free_super(st);
>  				goto abort_locked;
>  			}

Hi Jes,
 this doesn't seem right.  You message would print e.g.

    mdadm: Failed to write metadata to /dev/md1

but one doesn't write metadata to an array, one writes it to the member
devices.
Each ->write_init_super function should print out a message if a write
fails.  So I think we just remove the error message here, and make sure
each ->write_init_super does print an error in each case (there might be a
couple of holes).

Could you try that approach instead?

Thanks,
NeilBrown

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

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

* Re: [PATCH] Print correct md device name if write_init_super fails
  2012-02-21 19:53 ` NeilBrown
@ 2012-02-22 11:00   ` Jes Sorensen
  0 siblings, 0 replies; 3+ messages in thread
From: Jes Sorensen @ 2012-02-22 11:00 UTC (permalink / raw)
  To: NeilBrown; +Cc: meyering, linux-raid

On 02/21/12 20:53, NeilBrown wrote:
> On Tue, 21 Feb 2012 13:30:02 +0100 Jes.Sorensen@redhat.com wrote:
>> diff --git a/Create.c b/Create.c
>> index 90ff3ed..702ac34 100644
>> --- a/Create.c
>> +++ b/Create.c
>> @@ -926,7 +926,7 @@ int Create(struct supertype *st, char *mddev,
>>  			if (st->ss->write_init_super(st)) {
>>  				fprintf(stderr,
>>  					Name ": Failed to write metadata to %s\n",
>> -					dv->devname);
>> +					mddev);
>>  				st->ss->free_super(st);
>>  				goto abort_locked;
>>  			}
> 
> Hi Jes,
>  this doesn't seem right.  You message would print e.g.
> 
>     mdadm: Failed to write metadata to /dev/md1
> 
> but one doesn't write metadata to an array, one writes it to the member
> devices.
> Each ->write_init_super function should print out a message if a write
> fails.  So I think we just remove the error message here, and make sure
> each ->write_init_super does print an error in each case (there might be a
> couple of holes).
> 
> Could you try that approach instead?

Hi Neil,

Makes sense - this was the best I could do in the global context, but I
see the various write_init_super() functions already print errors.

Replacement patch coming your way in 60 seconds or so.

Cheers,
Jes

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

end of thread, other threads:[~2012-02-22 11:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21 12:30 [PATCH] Print correct md device name if write_init_super fails Jes.Sorensen
2012-02-21 19:53 ` NeilBrown
2012-02-22 11:00   ` Jes Sorensen

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).