On Sun, 12 Dec 1999, Alan Cox wrote:

> > I'm working on the USB Mass Storage driver, which appears to be a SCSI
> > host controller to the kernel.  The question I have is this: how do I
> > inform the higher SCSI layers that a device has appeared and disappeared?
> 
> The scsi layer doesn't really have a generic idea about this except for with
> entire adapters vanishing (PCMCIA). It might be worth looking at how the
> parallel port zip drive handles some of these issues.

        Not strictly true.  Under normal circumstances there is no
situation where devices appear and disappear without the corresponding
host appearing and disappearing.  Nonetheless, the code that hooks into
the proc filesystem looks like it is doing a lot of the right steps for
adding/removing devices on the fly, but I haven't looked at it closely
enough to say for certain.  That being said, the way they are doing it
needs to be cleaned up, as there are some kluges in there.

        I should also caution that there are lots of minor race conditions
when using things like this.  Technically we need to add a reader-writer
lock so that we can modify the structures in the places where they need to
be modified without imposing limitations for things that just need to
traverse the list.

        If you can ensure that the host is otherwise idle, then I would
feel more comforatable about adding and removing new devices on the fly.

> > Mostly, I'm concerned with when devices appear.  I can trace the code flow
> > when a user does an "echo 'scsi add-single-device 0 0 0 0' >
> > /proc/scsi/scsi, but is that safe to call at all times?  Are there any
> > restrictions on it's use?
> 
> Hard to say, its horrible code and about to get a partial overhaul. It should
> be safe to do that from a kernel thread context providing you don't hold the
> io request lock and are not doing it from a scsi function. 

        I haven't really touched the way that the bus is scanned or the
way the host/device/command datastructures are connected to each other.
What I have done is to redo how commands are actually queued.  Unless you
are thinking of something that someone else is doing...

-Eric



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to