Or Gerlitz wrote:
> Mike Christie <micha...@cs.wisc.edu> wrote:
> 
>> The scsi_host_template->queuecommand function is called by scsi-ml with
>> irqs disabled spin_lock_irqsave(host->host_lock, flags)
>  
> thanks for clarifying that, specifically do you refer to scsi.c ::
> scsi_dispatch_cmd()? at some point I was LXR-ing for queuecommand and

scsi_dispatch_cmd and then there is a scsi_host_template->queuecommand 
call in scsi_err.c used to inject error handling cmds (for example if we 
return success in eh_abort then scsi-ml will call queuecommand to send a 
TUR).

The host lock is also taken in the scsi-ml completion paths, and some 
other places like for checking some state. It is actually taken a little 
before scsi_lib.c calls scsi_dispatch_cmd to check some state, then 
dropped before scsi_dispatch_cmd is called then taken again in there.


> somehow got a bit confused thinking that this isn't the only flow the
> invokes queuecommand. If this --is-- the case, then I'm back to my 2nd
> question... why iscsi_queuecommand does spin_unlock(host->host_lock)
> in its beginning and spin_lock(host->host_lock) in its end?

We do not use the host lock for anything really. We just grab it a 
couple times to check some host values that are set under the host lock, 
but we do not need the host lock for any send/complete synchronization 
reasons, and there is no scsi-ml reason that drivers have to have the 
host lock in their queuecommand in the current code.

I think a long time ago drivers used the host lock like how we use the 
session lock, but if you look at newer drivers like qla2xxx or lpfc or 
fnic, etc they drop the host lock then grab their own private locks. 
There has been discussion on linux-scsi to just remove the host lock and 
let drivers use their own. The problem is that we have to figure out 
what the older drivers were using the host lock for and fix them up.

--

You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-is...@googlegroups.com.
To unsubscribe from this group, send email to 
open-iscsi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/open-iscsi?hl=en.


Reply via email to