Re: [PATCH v4 09/37] target: Make it possible to specify I_T nexus for SCSI abort

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

 



On Wed, 2017-02-08 at 14:24 -0800, Bart Van Assche wrote:
> target_submit_tmr() only supports the I_T_L nexus for SCSI abort
> and other task management functions. Make it possible for target
> drivers to specify I_T nexus for SCSI abort by passing the
> TARGET_SCF_IGNORE_TMR_LUN flag to target_submit_tmr().
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> Cc: Himanshu Madhani <himanshu.madhani@xxxxxxxxxx>
> Cc: Giridhar Malavali <giridhar.malavali@xxxxxxxxxx>
> ---
>  drivers/target/target_core_tmr.c       | 16 +++++++++++++++-
>  drivers/target/target_core_transport.c | 30 +++++++++++++++++++++++-------
>  include/target/target_core_base.h      |  1 +
>  3 files changed, 39 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c
> index 311dc3c2f1dc..367799b4dde1 100644
> --- a/drivers/target/target_core_tmr.c
> +++ b/drivers/target/target_core_tmr.c
> @@ -149,6 +149,13 @@ static bool __target_check_io_state(struct se_cmd *se_cmd,
>  	return kref_get_unless_zero(&se_cmd->cmd_kref);
>  }
>  
> +/**
> + * core_tmr_abort_task - abort a SCSI command
> + * @dev: LUN specified in task management function or NULL if no LUN has been
> + *	 specified.
> + * @tmr: Task management function.
> + * @se_sess: Session a.k.a. I_T nexus.
> + */
>  void core_tmr_abort_task(
>  	struct se_device *dev,
>  	struct se_tmr_req *tmr,
> @@ -161,7 +168,7 @@ void core_tmr_abort_task(
>  	spin_lock_irqsave(&se_sess->sess_cmd_lock, flags);
>  	list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) {
>  
> -		if (dev != se_cmd->se_dev)
> +		if (dev && dev != se_cmd->se_dev)
>  			continue;
>  
>  		/* skip task management functions, including tmr->task_cmd */
> @@ -178,6 +185,13 @@ void core_tmr_abort_task(
>  		if (!__target_check_io_state(se_cmd, se_sess, 0))
>  			continue;
>  
> +		if (!tmr->tmr_dev &&
> +		    transport_lookup_tmr_lun(tmr->task_cmd,
> +					     se_cmd->orig_fe_lun) < 0) {
> +			target_put_sess_cmd(se_cmd);
> +			continue;
> +		}
> +

There is a deadlock here.  While se_sess->sess_cmd_lock is held and
transport_lookup_tmr_lun() is called above, se_device->se_tmr_lock is
also taken.

However, core_tmr_drain_tmr_list() holds se_device->se_tmr_lock while
walking se_device->se_tmr_list and taking se_sess->sess_cmd_lock on each
se_tmr_req->task_cmd.

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