Skip to contentSkip to conversation

Segfault with --assemble --force

PATCH In review Chris Webb 2 participants 2 messages Jun 18, 2008 – Jun 19, 2008 MD RAID

lore
Share & tools
lore

Chris Webb

author
#0 lore raw

PATCH 1/1 Segfault with --assemble --force

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:

Assemble.c +1 -1
diff -uNrp mdadm-2.6.7.orig/Assemble.c mdadm-2.6.7/Assemble.c
@@ -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.

#1 lore raw
Quoted 11 lines · On Wednesday June 18, [email protected] 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

Assemble.c int Assemble(struct supertype *st, char · line 662

Quoted 8 lines
Assemble.c +1 -1
@@ -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