On Tue, 9 Aug 2005, Stefan Richter wrote: > Alan Stern wrote: > > On Mon, 8 Aug 2005, Stefan Richter wrote: > >>But after all high-level drivers were detached (and that should > >>have happend right before scsi_remove_host returns) I don't see why > >>the host's ref count might not be down to zero. > > > > There might still be outstanding references: processes holding files > > open, that sort of thing. > > But as long as files are open etc., scsi high-level drivers are > 'in use', cannot be detached, and scsi_remove_host does not return. > > Or that's what I assumed so far. No, that's not right. scsi_remove_host _can_ return while the high-level drivers are still in use -- just think about what happens when you unplug a USB storage device without unmounting it first. I'm not sure what you mean about "detach"ing high-level SCSI drivers. The high-level drivers are notified about the device removal; they drop their references and return. They can still submit commands if they want, but all such submissions will fail in the SCSI core. What can't happen is that the LLD's module can't be unloaded from memory. That's prevented by the open files holding a reference to the module. Alan Stern - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html