Re: [PATCH 04/19] target/fileio: Avoid that zero-length READ and WRITE commands hang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2017-05-04 at 15:50 -0700, Bart Van Assche wrote:
> From __target_execute_cmd() (simplified):
> 
> 	ret = cmd->execute_cmd(cmd);
> 	if (ret != 0)
> 		transport_generic_request_failure(cmd, ret);
> 
> From sbc_execute_rw():
> 
> 	return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents,
> 			       cmd->data_direction);
> 
> This means that sbc_ops.execute_rw() must either return a non-zero
> value or call target_complete_cmd() and return zero or command
> execution stalls. Make sure that fd_execute_rw() calls
> target_complete_cmd() even for zero-length commands.
> 
> Fixes: commit c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Cc: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Andy Grover <agrover@xxxxxxxxxx>
> Cc: David Disseldorp <ddiss@xxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>
> ---
>  drivers/target/target_core_file.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 1bf6c31e4c21..73b8f93a5fef 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -608,8 +608,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
>  	if (ret < 0)
>  		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
>  
> -	if (ret)
> -		target_complete_cmd(cmd, SAM_STAT_GOOD);
> +	target_complete_cmd(cmd, SAM_STAT_GOOD);
>  	return 0;
>  }
>  

Applied, with a commit log to reflect that zero-length commands used to
be handled by target-core, but since commit d81cb447 (v3.7) they are now
submitted to backend drivers.



--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux