Re: SCSI host numbers?

From: Itai Nahshon (
Date: Wed Jan 02 2002 - 18:35:32 EST

On Wednesday 02 January 2002 01:32 pm, Alan Cox wrote:
> > Under some scenarios Linux assigns the same
> > host_no to more than one scsi device.
> >
> > Can someone tell me what is the intended behavior?
> A number should never be reissued.
> > The problem is that a newly registered device gets
> > its host_no from max_scsi_host. max_scsi_host is
> > decremented when a device driver is unregistered
> > (see drivers/scsi/host.c) allowing a second new
> > host to reuse the same host_no.
> I guess it needs to either only decrement the count if we are the highest

I'll argue that it should never decrement. The host that was just
unregisrtered already has its host_id reserved and if we decrement,
this number will be reasigned to the next new scsi host.

Unless if the code for reservation that causes the conflicts
is removed (but I guess it has a reason).

> one (trivial hack) or scan for a free number/keep a free bitmap. The devfs
> code has a handy little unique_id function for that

That would not solve it. The problem is that one piece of code
tries to allocate unique numbers (and get them back to the pool
when they are not in use), another piece of code remembers the
old number that a scsi host had and whan it re-registers gives
it back its old host_no regardless if this number was re-assigned
to a new host.

Is there a function that given a string returns a unique number
for this string? That would do the job.

-- Itai

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Jan 07 2002 - 21:00:19 EST