[PATCH][2.5] Fix raid0 init failure

From: Zwane Mwaikambo (zwane@linuxpower.ca)
Date: Tue Jun 10 2003 - 21:18:27 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:26 EST