[4609] in linux-scsi channel archive
Re: [PATCH] SCSI host numbering
daemon@ATHENA.MIT.EDU (Andrzej Krzysztofowicz)
Tue Aug 25 08:16:13 1998
From: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
To: eric@andante.jic.com (Eric Youngdale)
Date: Tue, 25 Aug 1998 10:54:59 +0200 (CEST)
Cc: linux-scsi@vger.rutgers.edu, alan@lxorguk.ukuu.org.uk,
torvalds@transmeta.com
In-Reply-To: <Pine.LNX.3.95.980825004718.28847N-100000@andante.jic.com> from "Eric Youngdale" at Aug 25, 98 00:54:48 am
Hi Eric,
> On Mon, 24 Aug 1998, Andrzej Krzysztofowicz wrote:
>
> > 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:
>
> While it certainly looks like we have a bug, I am not sure if I
> agree with the proposed patch. It looks like you are making a second
> attempt to remove the entry from the linked list, when in fact this should
> have already happened. Wouldn't it be sufficient to simply do:
>
> > - if (max_scsi_hosts == next_scsi_host)
> > - max_scsi_hosts--;
> > -
> > + if(max_scsi_hosts == next_scsi_host
> > + && sh->host_no == max_scsi_hosts - 1) {
> > + --max_scsi_hosts;
> > + }
>
> -Eric
Your version of patch seems to be minimal bugfix for the problem.
But it limits reusing of host numbers very much.
Notice that
max_scsi_hosts == next_scsi_host
only if all(!) host numbers 0, 1, ..., max_scsi_hosts-1 are curently used.
max_scsi_hosts - it's maximal used host number minus 1,
next_scsi_host - it's number of curently used host numbers;
it should always be next_scsi_host <= max_scsi_hosts
equality ONLY if all: 0, 1, ..., max_scsi_hosts-1 are curently used
In my opinion names of above variables do not fit their role - maybe they
should be changed ???
My version aloows to reuse not only the last number released but it (eg. n)
alows to reuse those of numbers directly below it (n-1, n-2, ...) which have
been released earlier. An example:
We have 3 hosts; used numbers 0,1,2 ; next loaded will be 3
We unload host 1; 0, 2 ; 3
We unload host 2; 0 ; 1
( your version - next will be 3; it does not allow to
reuse 1 & 2, which also are free in this case. )
My patch ensures that after releasing all host numbers the next driver
loaded will always get number 0, independently on sequence of unloading.
Your patch generates possibility of infinite growing host numbers
in systems with many dynamically used scsi drivers (many adapters)
and long uptime. But it doesn't seem to be dangerous in 2.1 as both
max_scsi_hosts and next_scsi_host are int.
Regards
Andrzej
--
=======================================================================
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