kernel panic wile mounting root

Heinz Mauelshagen (mauelsha@ez-darmstadt.telekom.de)
Fri, 20 Nov 1998 9:02:32 MET


Hi!

I did send this a while ago but didn't get any comments...
Maybe it is the reason for Petko Manolov's trouble too.
Found the bug(s) in 2.1.129 again 8*(

Please test.

The bug causes that fault if you have 12 + n * 16 scsi disks in the system
with 2.1.12[7-9].

Regards,
Heinz

Patches for 2.1.12[89] follow:

--- linux-2.1.128.orig/drivers/scsi/sd.c Mon Oct 26 23:04:21 1998
+++ linux-2.1.128/drivers/scsi/sd.c Sun Nov 15 18:46:39 1998
@@ -1487,7 +1487,7 @@
sd_template.dev_max = 128;

if(!sd_registered) {
- for (i=0; i <= sd_template.dev_max / SCSI_DISKS_PER_MAJOR; i++) {
+ for (i=0; i <= ( sd_template.dev_max - 1 )/ SCSI_DISKS_PER_MAJOR; i++) {
if (register_blkdev(SD_MAJOR(i),"sd",&sd_fops)) {
printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i));
return 1;
@@ -1540,8 +1540,14 @@
sd_gendisks[i].real_devices =
(void *) (rscsi_disks + i * SCSI_DISKS_PER_MAJOR);
}
- LAST_SD_GENDISK.max_nr =
- sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
+
+ if ( sd_template.dev_max == 0)
+ LAST_SD_GENDISK.max_nr = 0;
+ else if ( sd_template.dev_max % SCSI_DISKS_PER_MAJOR == 0)
+ LAST_SD_GENDISK.max_nr = SCSI_DISKS_PER_MAJOR;
+ else
+ LAST_SD_GENDISK.max_nr = sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
+
LAST_SD_GENDISK.next = NULL;
return 0;
}

--- linux-2.1.129.orig/drivers/scsi/sd.c Thu Nov 19 01:42:44 1998
+++ linux-2.1.129/drivers/scsi/sd.c Thu Nov 19 19:57:19 1998
@@ -1487,7 +1487,7 @@
sd_template.dev_max = 128;

if(!sd_registered) {
- for (i=0; i <= sd_template.dev_max / SCSI_DISKS_PER_MAJOR; i++) {
+ for (i=0; i <= ( sd_template.dev_max - 1) / SCSI_DISKS_PER_MAJOR; i++) {
if (register_blkdev(SD_MAJOR(i),"sd",&sd_fops)) {
printk("Unable to get major %d for SCSI disk\n", SD_MAJOR(i));
return 1;
@@ -1540,8 +1540,12 @@
sd_gendisks[i].real_devices =
(void *) (rscsi_disks + i * SCSI_DISKS_PER_MAJOR);
}
- LAST_SD_GENDISK.max_nr =
- sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
+ if ( sd_template.dev_max == 0)
+ LAST_SD_GENDISK.max_nr = 0;
+ else if ( sd_template.dev_max % SCSI_DISKS_PER_MAJOR == 0)
+ LAST_SD_GENDISK.max_nr = SCSI_DISKS_PER_MAJOR;
+ else
+ LAST_SD_GENDISK.max_nr = sd_template.dev_max % SCSI_DISKS_PER_MAJOR;
LAST_SD_GENDISK.next = NULL;
return 0;
}

--

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Systemmanagement Entwicklungsbereich 2 Deutsche Telekom AG Entwicklungszentrum Darmstadt Heinz Mauelshagen Otto-Roehm-Strasse 71c Postfach 10 05 41 mge@ez-darmstadt.telekom.de 64205 Darmstadt Germany +49 6151 886-425 FAX-386 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/