Subject: iSCSI abort task - the saga continues

From: "Julian Satran" <[email-masked]>
Date: Mon, 3 Sep 2001 22:52:40 +0300

Dear colleagues,

Here is a simpler version of the Task Management Request & Response.

Abort task is processed only at target but the initiator issues it only on
the same connection (as Santosh Rao once proposed) with the added semantic
that if the connection is failing it can be issued on a new connection and
it means both abort and change allegiance. Here is the proposed text:

1.1  Task Management Function Request

   Byte /    0       |       1       |       2       |       3       |
      /              |               |               |               |
     |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
     +---------------+---------------+---------------+---------------+
    0|X|I| x02       |0| Function    | Reserved                      |
     +---------------+---------------+---------------+---------------+
    4| Reserved                                                      |
     +---------------+---------------+---------------+---------------+
    8| Logical Unit Number (LUN) or Reserved                         |
     +                                                               +
   12|                                                               |
     +---------------+---------------+---------------+---------------+
   16| Initiator Task Tag                                            |
     +---------------+---------------+---------------+---------------+
   20| Referenced Task Tag or 0xffffffff                             |
     +---------------+---------------+---------------+---------------+
   24| CmdSN                                                         |
     +---------------+---------------+---------------+---------------+
   28| ExpStatSN                                        |
     +---------------+---------------+---------------+---------------+
   32| RefCmdSN or ExpDataSN                                         |
     +---------------+---------------+---------------+---------------+
   36/ Reserved                                                      /
    +/                                                               /
     +---------------+---------------+---------------+---------------+
   48

1.1.1     Function

   The Task Management functions provide an initiator with a way to
   explicitly control the execution of one or more Tasks (SCSI and iSCSI
   tasks). The Task Management functions are (for a more detailed
   description of SCSI task management see [SAM2]):

      1    ABORT TASK - aborts the task identified by the Referenced
      Task Tag field.
      2    ABORT TASK SET - aborts all Tasks issued by this initiator on
      the Logical Unit.
      3    CLEAR ACA - clears the Auto Contingent Allegiance condition.
      4    CLEAR TASK SET - Aborts all Tasks (from all initiators) for the
      Logical Unit.
      5    LOGICAL UNIT RESET
      6    TARGET WARM RESET
7    TARGET COLD RESET
8    TASK RESUME - restart the task identified by the Referenced Task Tag
field on this connection
9    TASK REPLAY - replay the task identified by the Referenced Task Tag
field on this connection

   For all these functions, if executed, the Task Management Function
   Response MUST be returned using the Initiator Task Tag to identify the
   operation for which it is responding. All those functions apply to the
   referenced tasks regardless if they are proper SCSI tasks or tagged
   iSCSI operations.  Task management commands must be executed as if all
   the commands having a CmdSN lower or equal to the task management CmdSN
   have been received by the target (i.e., have to be executed as if
   received for ordered delivery even when marked for immediate delivery).
   For all the tasks covered by the task management response (i.e., with
   CmdSN not higher than the task management command CmdSN), additional
   responses MUST NOT be delivered to the SCSI layer after the task
   management response.

   ABORT TAST Task Management Request MUST be issued on the same connection
   to which the task to be aborted is allegiant at the time the Task
   Management Request is issued if the connection is still active (it is
   not undergoing an implicit or explicit logout).  If the connection is
   being implicitly or explicitly logged out and no other request will be
   issued on the failing connection and no other response will be received
   on the failing connection then an ABORT TASK Task Management request may
   be issued on another connection and this Task Management request will
   both establish a new allegiance for the command to be aborted and will
   abort it (i.e., a task to be aborted will not have to be reinstated,
   restarted or replayed and its status if issued but not acknowledged will
   be reissued). For the ABORT TASK task management request the target MUST
   NOT deliver additional responses after the task management response.
   Whether the initiator should deliver or not task responses while a TASK
   ABORT is executing but before delivering the task management response is
   a matter of implementation.

   For the LOGICAL UNIT RESET function, the target MUST behave as dictated
   by the Logical Unit Reset function in [SAM2].

   The TARGET RESET function (WARM and COLD) implementation is OPTIONAL and
   when implemented should act as described below.  Target Reset MAY be
   also subject to SCSI access controls for the requesting initiator.  When
   not implemented or when authorization fails at target, Target Reset
   functions should end as if the function was executed successfully and
   the response qualifier will detail what was executed.

   For the TARGET WARM RESET and TARGET COLD RESET functions, the target
   cancels all pending operations and are both equivalent to the Target
   Reset function specified by [SAM2].  They can both affect many other
   initiators.

   In addition, for the TARGET COLD RESET the target then MUST terminate
   all of its TCP connections to all initiators (all sessions are
   terminated).

   For the TASK RESUME and TASK REPLAY the target should resume executing
   the referenced task respectively replay it completely. TASK REPLAY MUST
   be received by the target ONLY after the status for the command was
   issued. TASK RESUME MUST be received by the target ONLY after the
   connection on which the command was previously executing has been
   successfully logged-out.
   TASK RESUME and TASK REPLAY MUST be issued as immediate commands.

1.1.2     LUN

   This field is required for functions addressing a specific LU (ABORT
   TASK, CLEAR TASK SET, ABORT TASK SET, CLEAR ACA, LOGICAL UNIT RESET) and
   is reserved in all others.

1.1.3     Referenced Task Tag

   Initiator Task Tag of the task to be aborted, restarted or replayed

1.1.4     RefCmdSN or ExpDataSN

   For ABORT TASK the task CmdSN to enable task removal. If RefCmdSN does
   not match the CmdSN of the command to be aborted at the target
   The abort action MUST not be performed and the response MUST be function
   rejected.

   If the function is task resume establishing a new connection allegiance
   for a previously issued command, this field will contain the next
   consecutive input DataSN number expected by the initiator (no gaps) for
   the referenced command in a previous execution.

1.2  Task Management Function Response

   Byte /    0       |       1       |       2       |       3       |
      /              |               |               |               |
     |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|
     +---------------+---------------+---------------+---------------+
    0|1|1| 0x22      |1| Reserved                                    |
     +---------------+---------------+---------------+---------------+
    4/ Reserved                                                      /
     /                                                               /
     +---------------+---------------+---------------+---------------+
   16| Initiator Task Tag                                            |
     +---------------+---------------+---------------+---------------+
   20| Referenced Task Tag or 0xffffffff                             |
     +---------------+---------------+---------------+---------------+
   24| StatSN                                                        |
     +---------------+---------------+---------------+---------------+
   28| ExpCmdSN                                                      |
     +---------------+---------------+---------------+---------------+
   32| MaxCmdSN                                                      |
     +---------------+---------------+---------------+---------------+
   36| Response      | Qualifier     | Reserved                      |
     +---------------+---------------+---------------+---------------+
   40/ Reserved                                                      /
    +/                                                               /
     +---------------+---------------+---------------+---------------+
   48

   For the functions ABORT TASK, ABORT TASK SET, CLEAR ACA, CLEAR TASK SET,
   LOGICAL UNIT RESET, TARGET WARM RESET, the target performs the requested
   Task Management function and sends a Task Management Response back to
   the initiator. The target provides a Response, which may take on the
   following values:

           0 - Function Complete
           1 - Task specified in the Referenced Task Tag field was not in
           task set
           2 - LUN does not exist
           3 - Task running on a connection that was not logged-out
           4 - Task failover not supported
           5 - Task in progress
           6 - Task replay not supported
      255   Function Rejected

   All other values are reserved.

   The Qualifier field provides additional information about the Response.

   For a Response of "Function Complete" the valid Qualifiers are:

      0 - Function Executed
      1 - Not Authorized

   For the TARGET COLD RESET and TARGET WARM RESET functions, the target
   cancels all pending operations.  For the TARGET COLD RESET function the
   target MUST then close all of its TCP connections to all initiators
   (terminates all sessions).

   The mapping of the response code into a SCSI service response code, if
   needed, is outside the scope of this document.

1.2.1     Referenced Task Tag

   Initiator Task Tag of the task not found used in conjunction with
   responses referring to a specific task. It MUST be set to 0xffffffff in
   other cases.

   Comments?

   Julo

---

From: Sandeep Joshi <[email-masked]>
Date: Mon, 03 Sep 2001 20:42:00 -0400

Julian,

Great..less complexity!

a) I guess this eliminates Sec 8.3 & Sec 8.4 then ?
   Is there a need to eliminate unrelated commands which
   are lower than the cmdSN of the task to be aborted ?

  >    responses MUST NOT be delivered to the SCSI layer after the task

b) What is the value in retaining refCmdSN in the PDU now 
   that the same connection is being used for abort task ?
   Even in case of failing connections, the ITT will be used
   by the target to determine if the task to be aborted 
   exists, correct?

-Sandeep