[4599] in linux-scsi channel archive
[PATCH] SCSI host numbering
daemon@ATHENA.MIT.EDU (Andrzej Krzysztofowicz)
Mon Aug 24 05:29:47 1998
From: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
To: linux-scsi@vger.rutgers.edu
Date: Mon, 24 Aug 1998 10:29:31 +0200 (CEST)
Cc: alan@lxorguk.ukuu.org.uk, torvalds@transmeta.com
Hi,
While testing behaviour of system with two or more different scsi
adapters I found that sometimes different scsi hosts use the same
host_no. It breaks at minimum proc info. I don't know what else can be
broken in such situation, but allowing same host_no for different
adapters means looking for trouble.
Problem appears both in 2.1.117 as well as in Alan's 2.0.36pre6.
Patches are included. The following example shows how to reproduce this
problem:
[root@xxx root]# modprobe qlogicfas
scsi0 : Qlogicfas Driver version 0.46, chip 40 at 230, IRQ 12, TPdma:1
scsi : 1 host.
[root@xxx root]# modprobe aha1542
Configuring Adaptec (SCSI-ID 7) at IO:334, IRQ 11, DMA priority 6
scsi1 : Adaptec 1542
scsi : 2 hosts.
[root@xxx root]# rmmod qlogicfas
scsi : 1 host.
[root@xxx root]# modprobe qlogicfas
scsi1 : Qlogicfas Driver version 0.46, chip 40 at 230, IRQ 12, TPdma:1
scsi : 1 host.
[root@xxx root]# ls -l /proc/scsi/*
-rw-r--r-- 1 root root 0 Aug 23 21:51 /proc/scsi/scsi
/proc/scsi/aha1542:
total 0
-rw-r--r-- 1 root root 0 Aug 23 21:51 1
/proc/scsi/qlogic:
total 0
-rw-r--r-- 1 root root 0 Aug 23 21:51 1
[root@xxx root]# cat /proc/scsi/qlogic/1
Qlogicfas Driver version 0.46, chip 40 at 230, IRQ 12, TPdma:1
[root@xxx root]# cat /proc/scsi/aha1542/1
Qlogicfas Driver version 0.46, chip 40 at 230, IRQ 12, TPdma:1
^^^^^^^^^^ !!! (should be from Adaptec)
Regards
Andrzej
*******************************************************************************
diff -u linux-2.1.117/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c
--- linux-2.1.117/drivers/scsi/hosts.c Fri Aug 21 20:01:53 1998
+++ linux/drivers/scsi/hosts.c Sun Aug 23 21:03:04 1998
@@ -519,9 +519,15 @@
/* If we are removing the last host registered, it is safe to reuse
* its host number (this avoids "holes" at boot time) (DB)
*/
- if (max_scsi_hosts == next_scsi_host)
- max_scsi_hosts--;
-
+ if(sh->host_no == max_scsi_hosts - 1) {
+ while(--max_scsi_hosts >= next_scsi_host) {
+ shpnt = scsi_hostlist;
+ while(shpnt && shpnt->host_no != max_scsi_hosts - 1)
+ shpnt = shpnt->next;
+ if(shpnt)
+ break;
+ }
+ }
next_scsi_host--;
scsi_init_free((char *) sh, sizeof(struct Scsi_Host) + sh->extra_bytes);
}
*******************************************************************************
diff -u linux-2.0.36pre6/drivers/scsi/hosts.c linux/drivers/scsi/hosts.c
--- linux-2.0.36pre6/drivers/scsi/hosts.c Mon Jul 13 22:47:33 1998
+++ linux/drivers/scsi/hosts.c Sun Aug 23 21:59:34 1998
@@ -358,9 +358,15 @@
/* If we are removing the last host registered, it is safe to reuse
* its host number (this avoids "holes" at boot time) (DB)
*/
- if (max_scsi_hosts == next_scsi_host)
- max_scsi_hosts--;
-
+ if(sh->host_no == max_scsi_hosts - 1) {
+ while(--max_scsi_hosts >= next_scsi_host) {
+ shpnt = scsi_hostlist;
+ while(shpnt && shpnt->host_no != max_scsi_hosts - 1)
+ shpnt = shpnt->next;
+ if(shpnt)
+ break;
+ }
+ }
next_scsi_host--;
scsi_init_free((char *) sh, sizeof(struct Scsi_Host) + sh->extra_bytes);
}
--
=======================================================================
Andrzej M. Krzysztofowicz ankry@mif.pg.gda.pl
phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math., Technical University of Gdansk
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu