Re: [PATCH v4 31/37] target: Change return type of transport_wait_for_tasks() into void

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

 



On Wed, 2017-02-08 at 14:25 -0800, Bart Van Assche wrote:
> None of the callers of this function uses the returned value. Hence
> change the return type into void.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Andy Grover <agrover@xxxxxxxxxx>
> Cc: David Disseldorp <ddiss@xxxxxxx>
> ---
>  drivers/target/target_core_transport.c | 21 ++++++++-------------
>  include/target/target_core_fabric.h    |  2 +-
>  2 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
> index f6d38eba139e..fdd06ecacd52 100644
> --- a/drivers/target/target_core_transport.c
> +++ b/drivers/target/target_core_transport.c
> @@ -2488,7 +2488,7 @@ static void transport_write_pending_qf(struct se_cmd *cmd)
>  	}
>  }
>  
> -static bool
> +static void
>  __transport_wait_for_tasks(struct se_cmd *, bool, unsigned long *flags);
>  
>  static void target_wait_free_cmd(struct se_cmd *cmd)
> @@ -2711,7 +2711,7 @@ void transport_clear_lun_ref(struct se_lun *lun)
>  	wait_for_completion(&lun->lun_ref_comp);
>  }
>  
> -static bool __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
> +static void __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
>  				       unsigned long *flags)
>  	__releases(&cmd->t_state_lock)
>  	__acquires(&cmd->t_state_lock)
> @@ -2725,17 +2725,17 @@ static bool __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
>  
>  	if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD) &&
>  	    !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
> -		return false;
> +		return;
>  
>  	if (!(cmd->se_cmd_flags & SCF_SUPPORTED_SAM_OPCODE) &&
>  	    !(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
> -		return false;
> +		return;
>  
>  	if (!(cmd->transport_state & CMD_T_ACTIVE))
> -		return false;
> +		return;
>  
>  	if (fabric_stop && (cmd->transport_state & CMD_T_ABORTED))
> -		return false;
> +		return;
>  
>  	cmd->transport_state |= CMD_T_STOP;
>  
> @@ -2752,24 +2752,19 @@ static bool __transport_wait_for_tasks(struct se_cmd *cmd, bool fabric_stop,
>  
>  	pr_debug("wait_for_tasks: Stopped wait_for_completion(&cmd->"
>  		 "t_transport_stop_comp) for ITT: 0x%08llx\n", cmd->tag);
> -
> -	return true;
>  }
>  

The return value is still required for the second order issue handling,
so transport_generic_free_cmd() can know when it must block on
se_cmd->cmd_wait_comp and invoke se_tfo->release_cmd() directly, before
returning to the caller and allowing session resource release to
proceed.

As described in patch #14, forward progress can't be made when
se_cmd->cmd_wait_comp blocks while still holding se_cmd->cmd_kref.

Because of that basic flaw, dropping this patch for now.

--
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