]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
target: Stop execution if CMD_T_STOP has been set
authorBart Van Assche <bart.vanassche@sandisk.com>
Mon, 9 Jan 2017 18:14:54 +0000 (10:14 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Thu, 9 Feb 2017 08:39:12 +0000 (00:39 -0800)
Stop execution if CMD_T_STOP has been set for a command just after
the command has been added to the device command list and before
.write_pending() is called. The following sequence can trigger this:
- transport_handle_cdb_direct() gets called. This function namely
  sets CMD_T_ACTIVE before it calls transport_generic_new_cmd().
- __transport_wait_for_tasks() is called concurrently. This function
  sets CMD_T_STOP for all active commands that have not been aborted.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_transport.c

index 62a50ea52a49ab5f9dbd48dea8e9b1953895f8cb..2d867af1961fc457b5c4ad0460e6c4a60bf88ac7 100644 (file)
@@ -2452,7 +2452,8 @@ transport_generic_new_cmd(struct se_cmd *cmd)
                target_execute_cmd(cmd);
                return 0;
        }
-       transport_cmd_check_stop(cmd, false, true);
+       if (transport_cmd_check_stop(cmd, false, true))
+               return 0;
 
        ret = cmd->se_tfo->write_pending(cmd);
        if (ret == -EAGAIN || ret == -ENOMEM)