On 04/06/12 17:15, James Bottomley wrote: > On Fri, 2012-04-06 at 17:01 +0000, Bart Van Assche wrote: >> Sorry, but I forgot to mention that it's not just scsi_dispatch_cmd() >> that invokes queuecommand via the host template. The SCSI error handler >> does that too. As far as I can see there is no protection in the SCSI >> error handler against LLD module removal. But maybe I overlooked something. > > Consider where the command came from: either it's come from startup (the > current problem), operation (in which case the device must be open to > send and receive it) or teardown (which is synchronous). Thanks, that helps. As you might have noticed I'm trying to understand all the lifetime and reference counting rules in the SCSI core. I've got another question about the SCSI error handler: how is it guaranteed that the 'struct scsi_driver' remains in existence as long as the SCSI error handler thread is active ? scsi_send_eh_cmnd() needs a pointer to the scsi_driver structure associated with the command it is sending as part of the error recovery. But I haven't been able to figure out yet how it is guaranteed that that scsi_driver structure remains around as long as the SCSI error handler needs it. Bart. -- To unsubscribe from this list: 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