Re: [PATCH 1/9] qla2xxx: Move cmd search out of qla during ABTS

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

 



On Sun, 2016-12-18 at 01:02 -0800, Himanshu Madhani wrote:
> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> index 6643f6f..9275f36 100644
> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
> @@ -567,6 +567,30 @@ static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun,
>  {
>  	struct qla_tgt_sess *sess = mcmd->sess;
>  	struct se_cmd *se_cmd = &mcmd->se_cmd;
> +	struct se_session *se_sess = sess->se_sess;
> +	bool found_lun = false;
> +
> +	switch (tmr_func) {
> +	case TMR_ABORT_TASK:
> +		spin_lock(&se_sess->sess_cmd_lock);
> +		list_for_each_entry(se_cmd, &se_sess->sess_cmd_list, se_cmd_list) {
> +			struct qla_tgt_cmd *cmd =
> +				container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
> +			struct abts_recv_from_24xx *abts = &mcmd->orig_iocb.abts;
> +
> +			if (se_cmd->tag == abts->exchange_addr_to_abort) {
> +				lun = cmd->unpacked_lun;
> +				found_lun = true;
> +				break;
> +			}
> +		}
> +		spin_unlock(&se_sess->sess_cmd_lock);
> +		if (!found_lun)
> +			return -ENOBUFS;
> +		break;
> +	default:
> +		break;
> +	}
>  
>  	return target_submit_tmr(se_cmd, sess->se_sess, NULL, lun, mcmd,
>  			tmr_func, GFP_ATOMIC, tag, TARGET_SCF_ACK_KREF);

Hello Himanshu,

Please consider removing the sess_cmd_list loop. Any lookups in
sess_cmd_list should be performed by the target core and not by a
target driver. Are you aware that core_tmr_abort_task() performs a very
similar lookup to the one above?

Bart.��.n��������+%������w��{.n�����{������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux