]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
iscsi-target: Fix non-immediate TMR handling
authorNicholas Bellinger <nab@linux-iscsi.org>
Fri, 28 Oct 2011 20:37:19 +0000 (13:37 -0700)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 2 Nov 2011 15:57:13 +0000 (15:57 +0000)
This patch addresses two issues with non immediate TMR handling in
iscsit_handle_task_mgt_cmd().  The first involves breakage due to
v3.1-rc conversion of iscsit_sequence_cmd(), which upon good status
would hit the iscsit_add_reject_from_cmd() block of code.  This patch
adds an explict check for CMDSN_ERROR_CANNOT_RECOVER.

The second adds a check to return when non immediate TMR operation is
detected after iscsit_ack_from_expstatsn(), as iscsit_sequence_cmd()
-> iscsit_execute_cmd() will have called transport_generic_handle_tmr()
for the non immediate TMR case already.

Cc: Andy Grover <agrover@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/iscsi/iscsi_target.c

index 7855a63d49fcbb457f4ae0cee794f81bb1801336..1bf057ed9931690d8073e9980a92d92b6253fbaa 100644 (file)
@@ -1821,17 +1821,16 @@ attach:
                int cmdsn_ret = iscsit_sequence_cmd(conn, cmd, hdr->cmdsn);
                if (cmdsn_ret == CMDSN_HIGHER_THAN_EXP)
                        out_of_order_cmdsn = 1;
-               else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP) {
+               else if (cmdsn_ret == CMDSN_LOWER_THAN_EXP)
                        return 0;
-               } else { /* (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER) */
+               else if (cmdsn_ret == CMDSN_ERROR_CANNOT_RECOVER)
                        return iscsit_add_reject_from_cmd(
                                        ISCSI_REASON_PROTOCOL_ERROR,
                                        1, 0, buf, cmd);
-               }
        }
        iscsit_ack_from_expstatsn(conn, hdr->exp_statsn);
 
-       if (out_of_order_cmdsn)
+       if (out_of_order_cmdsn || !(hdr->opcode & ISCSI_OP_IMMEDIATE))
                return 0;
        /*
         * Found the referenced task, send to transport for processing.