diff mbox

[14/34] target: Stop execution if CMD_T_STOP has been set

Message ID 20170125233646.2243-15-bart.vanassche@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Jan. 25, 2017, 11:36 p.m. UTC
Stop execution in the unlikely scenario that 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.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
---
 drivers/target/target_core_transport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Hannes Reinecke Jan. 26, 2017, 7:59 a.m. UTC | #1
On 01/26/2017 12:36 AM, Bart Van Assche wrote:
> Stop execution in the unlikely scenario that 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.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Andy Grover <agrover@redhat.com>
> Cc: David Disseldorp <ddiss@suse.de>
> ---
>  drivers/target/target_core_transport.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index 55e1d3898bdd..f7b31cade25e 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -2442,7 +2442,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)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 55e1d3898bdd..f7b31cade25e 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2442,7 +2442,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)