2003-06-11 02:16:14

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.5] Fix raid0 init failure

create_strip_zone was accessing uninitialised data via
zone->dev = conf->devlist

Tested on a 2disk SCSI Raid0

BEFORE:
md0: setting max_sectors to 128, segment boundary to 32767
raid0: looking at sdf1
raid0: comparing sdf1(4193152) with sdf1(4193152)
raid0: END
raid0: ==> UNIQUE
raid0: 1 zones
raid0: looking at sdc1
raid0: comparing sdc1(4193152) with sdf1(4193152)
raid0: EQUAL
raid0: FINAL 1 zones
raid0: multiple devices for 1 - aborting!
md: pers->run() failed ...
md :do_md_run() returned -22
md: md0 stopped.
md: unbind<sdf1>
md: export_rdev(sdf1)
md: unbind<sdc1>
md: export_rdev(sdc1)
md: ... autorun DONE.

AFTER:
md0: setting max_sectors to 128, segment boundary to 32767
raid0: looking at sdf1
raid0: comparing sdf1(4193152) with sdf1(4193152)
raid0: END
raid0: ==> UNIQUE
raid0: 1 zones
raid0: looking at sdc1
raid0: comparing sdc1(4193152) with sdf1(4193152)
raid0: EQUAL
raid0: FINAL 1 zones
raid0: done.
raid0 : md_size is 8386304 blocks.
raid0 : conf->hash_spacing is 8386304 blocks.
raid0 : nb_zone is 1.
raid0 : Allocating 4 bytes for hash.
md: ... autorun DONE.

Index: linux-2.5/drivers/md/raid0.c
===================================================================
RCS file: /home/cvs/linux-2.5/drivers/md/raid0.c,v
retrieving revision 1.32
diff -u -p -B -r1.32 raid0.c
--- linux-2.5/drivers/md/raid0.c 5 Jun 2003 06:30:06 -0000 1.32
+++ linux-2.5/drivers/md/raid0.c 11 Jun 2003 00:51:30 -0000
@@ -90,6 +90,10 @@ static int create_strip_zones (mddev_t *

memset(conf->strip_zone, 0,sizeof(struct strip_zone)*
conf->nr_strip_zones);
+
+ memset(conf->devlist, 0, sizeof (mdk_rdev_t*)*
+ conf->nr_strip_zones*mddev->raid_disks);
+
/* The first zone must contain all devices, so here we check that
* there is a proper alignment of slots to devices and find them all
*/
--
function.linuxpower.ca


2003-06-11 04:11:14

by NeilBrown

[permalink] [raw]
Subject: Re: [PATCH][2.5] Fix raid0 init failure

On Tuesday June 10, [email protected] wrote:
> create_strip_zone was accessing uninitialised data via
> zone->dev = conf->devlist

Yes thank. There are few more of those in other raid levels. I'm
about to send a patch off to Linus.

NeilBrown