[PATCH] qla2xxx: Set cmd->sess / ->loop_id when creating session in qla_tgt_do_work()

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

 



From: Roland Dreier <roland@xxxxxxxxxxxxxxx>

Commit 401b01afba24 ("qla2xxx: Remove duplicate assignments from
qla_tgt_do_work") removed setting cmd->sess and cmd->loop_id, which is
usually OK, except when we end up creating a new session in
qla_tgt_do_work(), when it leads to dropping the command with the
message from tcm_qla2xxx_handle_cmd():

    Unable to locate struct qla_tgt_sess from qla_tgt_cmd

Re-add the needed assignments.

Longer term it seems we may want to move the looking up of sessions
into qla_tgt_do_work(), where it will be easier to avoid raciness that
leads to creating multiple local sessions when a burst of commands
comes in.

Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 51de953..81f8400 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2975,7 +2975,8 @@ static void qla_tgt_do_work(struct work_struct *work)
 			loop_id = GET_TARGET_ID(ha, atio);
 
 		mutex_lock(&ha->tgt_mutex);
-		sess = qla_tgt_make_local_sess(vha, s_id, loop_id);
+		cmd->sess = sess = qla_tgt_make_local_sess(vha, s_id, loop_id);
+		cmd->loop_id = sess->loop_id;
 		/* sess has got an extra creation ref */
 		mutex_unlock(&ha->tgt_mutex);
 
-- 
1.7.9

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