linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Segfault with --assemble --force
@ 2008-06-18 19:35 Chris Webb
  2008-06-19  3:52 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Webb @ 2008-06-18 19:35 UTC (permalink / raw)
  To: linux-raid

mdadm --assemble --force repeatedly segfaults when run on a raid6 array with
more than two components marked as failed, so at least one needs its event
count forcibly updated. sb->events is accessed with sb NULL in update_super1,
called from Assemble (line 667 of Assemble.c). I think the following patch is
correct:

diff -uNrp mdadm-2.6.7.orig/Assemble.c mdadm-2.6.7/Assemble.c
--- mdadm-2.6.7.orig/Assemble.c	2008-06-18 20:23:36.000000000 +0100
+++ mdadm-2.6.7/Assemble.c	2008-06-18 20:23:47.000000000 +0100
@@ -656,7 +656,7 @@ int Assemble(struct supertype *st, char 
 			continue;
 		}
 		tst = dup_super(st);
-		if (tst->ss->load_super(st,fd, NULL)) {
+		if (tst->ss->load_super(tst, fd, NULL)) {
 			close(fd);
 			fprintf(stderr, Name ": RAID superblock disappeared from %s - not updating.\n",
 				devices[chosen_drive].devname);

Cheers,

Chris.

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

* Re: [PATCH] Segfault with --assemble --force
  2008-06-18 19:35 [PATCH] Segfault with --assemble --force Chris Webb
@ 2008-06-19  3:52 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2008-06-19  3:52 UTC (permalink / raw)
  To: Chris Webb; +Cc: linux-raid

On Wednesday June 18, chris@arachsys.com wrote:
> mdadm --assemble --force repeatedly segfaults when run on a raid6 array with
> more than two components marked as failed, so at least one needs its event
> count forcibly updated. sb->events is accessed with sb NULL in update_super1,
> called from Assemble (line 667 of Assemble.c). I think the following patch is
> correct:
> 
> diff -uNrp mdadm-2.6.7.orig/Assemble.c mdadm-2.6.7/Assemble.c
> --- mdadm-2.6.7.orig/Assemble.c	2008-06-18 20:23:36.000000000 +0100
> +++ mdadm-2.6.7/Assemble.c	2008-06-18 20:23:47.000000000 +0100
> @@ -656,7 +656,7 @@ int Assemble(struct supertype *st, char 
>  			continue;
>  		}
>  		tst = dup_super(st);
> -		if (tst->ss->load_super(st,fd, NULL)) {
> +		if (tst->ss->load_super(tst, fd, NULL)) {
>  			close(fd);
>  			fprintf(stderr, Name ": RAID superblock disappeared from %s - not updating.\n",
>  				devices[chosen_drive].devname);
> 

Yes, definitely.

Thanks.

NeilBrown

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

end of thread, other threads:[~2008-06-19  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-18 19:35 [PATCH] Segfault with --assemble --force Chris Webb
2008-06-19  3:52 ` Neil Brown

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