Subject: RE: iSCSI: Logical Unit Reset

From: Eddy Quicksall <[email-masked]>
Date: Tue, 8 Oct 2002 13:08:59 -0400

I agree ... so what I said is correct; right? 

i.e., the statement in the spec is slightly incorrect in that it says "Task
management requests must act on all the commands having a CmdSN lower than
the task management CmdSN". That is not true because other sessions' CmdSN's
have no relationship to the issuing sessions commands.

Eddy

-----Original Message-----
From: Tony Battersby [mailto:[email-masked]]
Sent: Tuesday, October 08, 2002 1:02 PM
To: 'Eddy Quicksall'; [email-masked]
Subject: RE: iSCSI: Logical Unit Reset

> -----Original Message-----
> From: [email-masked] [mailto:[email-masked]]On Behalf Of
> Eddy Quicksall
> Sent: Tuesday, October 08, 2002 10:08 AM
> To: [email-masked]
> Subject: iSCSI: Logical Unit Reset
>
>
> Section 9.5.1 says:
>
> Task management requests must act on all the commands having
> a CmdSN lower
> than the task management CmdSN.
>
>
> But a Logical Unit Reset, Target [WARM | COLD] Reset and
> Clear Task Set
> w/TST=0 applies to all initiators for the Target or Target/LUN.
>
> Since the initiator that issued the TMF knows nothing about
> the CmdSN's of
> other initiators, how is this handled for the other sessions?
>
> One thing that can be done is to consider that the session
> that issued the
> TMF is synchronized only with itself and therefore its TMF
> would apply to
> all CmdSN's on the other sessions. A statement to this effect should
> probably be added to 9.5.1.

The initiator that issued the TMF is the only initiator that knows about the
TMF.  When a TMF aborts/clears a set of commands, the issuing iSCSI
initiator knows not to expect any more replies for the aborted commands.
Other initiators do not know that a TMF was executed, and therefore still
expect iSCSI replies for all the commands they have outstanding.  Therefore,
the iSCSI layer should NOT apply a TMF to commands from other initiators.
If need be, the SCSI layer can take care of aborting commands from other
initiators.  For example, when processing a Logical Unit Reset, the SCSI
layer can abort any outstanding SCSI commands from other initiators with
CHECK CONDITION / UNIT ATTENTION.

In other words, it is the SCSI layer rather than the iSCSI layer that
applies the TMF to commands from other initiators.

The Target Cold Reset is an exception to this, since the target terminates
all TCP connections to all initiators, effectively informing other
initiators that all outstanding commands were aborted.

Anthony J. Battersby
Cybernetics

---

From: "Tony Battersby" <[email-masked]>
Date: Tue, 8 Oct 2002 13:34:49 -0400

> From: Eddy Quicksall [mailto:[email-masked]]
> Sent: Tuesday, October 08, 2002 1:09 PM
> To: [email-masked]; [email-masked]

Yes, I suppose it would be more precise to say "... must act on all the
commands in the session having a CmdSN ...".  Maybe this could be included
in the next draft (if there is one)?  There might be a few other places that
could use this change also...

Tony

---

From: Bill Studenmund <[email-masked]>
Date: Tue, 8 Oct 2002 17:21:44 -0700 (PDT)

> could use this change also...

I'm confused. I thought what Eddie was talking about is the case where we
have two initiators (well two sessions). One of them issues some commands.
The other does a LU reset, wiping out those commands. Then the first comes
along and does a task management request on the original commands, which
aren't there anymore because the other session did a reset (and thus the
Task Management command can't work on them).

Or is that not what Eddie was talking about?

Take care,

Bill

---

From: "Tony Battersby" <[email-masked]>
Date: Wed, 9 Oct 2002 10:20:04 -0400

> Bill Studenmund
> Sent: Tuesday, October 08, 2002 8:22 PM
> To: Tony Battersby
> Cc: 'Eddy Quicksall'; [email-masked]

> Or is that not what Eddie was talking about?

I can't speak for Eddy, but to me this sounds like a slightly different but
related question.  Let me try to illustrate what I think should happen with
an example:

Suppose that two initiators, I1 and I2, have open sessions with the same
target.  Initiator I1 has an outstanding NOP-Out and an outstanding SCSI
command, and is waiting for a reply to both.  Initiator I2 also has an
outstanding NOP-Out and an outstanding SCSI command, and is waiting for a
reply to both.  At this point, initiator I1 issues a Logical Unit Reset.
The question is, what specifically happens to the four outstanding commands
(the two SCSI commands and the two NOP-In replies to the two NOP-Outs).

In section 9.5.1: "The iSCSI target MUST ensure that no responses for the
tasks covered by a task management function are delivered to the iSCSI
initiator after the Task Management response except for a task covered by a
TASK REASSIGN."  The use of the definite article "the" in the phrase "the
iSCSI initiator" implies that this sentence applies only to the initiator
that issued the TMF, and not to any other initiator.  For initiator I1, the
following sequences of events are valid for the target:

1) Return both the NOP-In and the normal response to the SCSI command
completing, followed by the TMF response.
2) Return only the NOP-In, followed by the TMF response.  Never return the
SCSI command response.
3) Return only the normal response to the SCSI command completing, followed
by the TMF response.  Never return the NOP-In.
4) Return the TMF response.  Never return the SCSI command response or the
NOP-In.

By "normal response to the SCSI command", I mean the response that would
have been returned had there not been a Logical Unit Reset.  Which sequence
of events is taken depends on the implementation and timings at the target.

The iSCSI draft doesn't say anything about what should happen to the
commands from initiator I2, so I assume that nothing should happen to them
except as specified by SAM-2 section 5.7.3 ("When a SCSI initiator port
aborts tasks from other SCSI initiator ports").  The NOP-In from initiator
I2 should not be affected at all, since the SCSI layer doesn't know about
it.  So basically, the Logical Unit reset from initiator I1 alters the SCSI
command response for the SCSI command from initiator I2, but it doesn't make
any tasks from initiator I2 suddenly disappear from the target.

So, to finally respond to your question, the assumption that the commands
"aren't there anymore because the other session did a reset" is incorrect
because the command _are_ still there.  After the LU Reset, the target is
still intending to return a response to both the NOP-Out and the SCSI
command from initiator I2.  The LU Reset from initiator I1 _has_ changed the
SCSI command response for the SCSI command from initiator I2, but has not
affected the commands from initiator I2 in any other way.

Anthony J. Battersby
Cybernetics