On 07/22/2009 12:24 PM, Mike Christie wrote:
> On 07/22/2009 12:00 PM, Mike Christie wrote:
>>> No, wrong. The check in queuecommand is by no means relevant
>>> to the actual window.
>>> We're checking the target window at the time queuecommand is run,
>>> but we're _generating_ the CmdSN only much later after we've
>>> dequeued the command.
>> The check in queuecommand is for scsi cmd pdus and checks the
>> session->queued_cmdsn against the MaxCmdSn. The queued_cmdsn is just a
>> preallocation of CmdSn values. So if the scsi layer sends us X commands,
>> the initiator checks if the window has X spaces open. If it does, then
>> we add the task to the cmdqueue, and increase queued_cmdsn. This is
>> supposed to prevent the scsi layer from sending us too many commands and
>> them sitting in the driver cmdqueue and timing out.
>> The cmdsn is then allocated when we put the cmd on the wire. So the
> Maybe this is causing some confusion. We do not increment the cmdsn
> value for immediate commands (how we send a tmf or nop) and for data-out
> pdus. We only increment it for scsi cmd pdus, so the only place I check
> for the window having space is in queuecommand. If you are worried about
> a nop or data out increasing the cmdsn value in one thread and a scsi
> cmd pdu increasing it in another, then it will not happen. We only this
> one path to worry about.
>> session->CmdSn should always be lower than the MaxCmdSn value (as long
>> as the MaxCmdSn value does not suddenly decrease on us (it cannot do

Ah, I guess it does not have a "MUST NOT" decrease in the RFC. There is 
this though:

       -  If the PDU MaxCmdSN is greater than the local MaxCmdSN (in
          Serial Arithmetic Sense), it updates the local MaxCmdSN;
          otherwise, it is ignored.

If the target did send a MaxCmdSN that is smaller than our local then we 
are not going to update our value. The target would then drop the scsi 
cmd pdu. The scsi cmd timeout for that cmd will eventually fire and we 
will go through that.

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

Reply via email to