Skip to content

Commit

Permalink
target: Fix assignment of LUN in tracepoints
Browse files Browse the repository at this point in the history
The unpacked_lun field in the SCSI target tracepoints should be
initialized with cmd->orig_fe_lun rather than cmd->se_lun->unpacked_lun
for two reasons:

 - most importantly, if we are in the cmd_complete tracepoint
   returning a check condition due to no LUN found, cmd->se_lun will
   be NULL and we'll crash trying to dereference it.

 - also, in any case, cmd->se_lun->unpacked_lun is an internal index
   into the target's internal set of LUNs; cmd->orig_fe_lun is much
   more useful and interesting, since it's the value the initiator
   actually sent.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Cc: <stable@vger.kernel.org> # 3.11+
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Roland Dreier authored and Nicholas Bellinger committed Oct 9, 2013
1 parent acb3f26 commit 2053a1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/trace/events/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ TRACE_EVENT(target_sequencer_start,
),

TP_fast_assign(
__entry->unpacked_lun = cmd->se_lun->unpacked_lun;
__entry->unpacked_lun = cmd->orig_fe_lun;
__entry->opcode = cmd->t_task_cdb[0];
__entry->data_length = cmd->data_length;
__entry->task_attribute = cmd->sam_task_attr;
Expand Down Expand Up @@ -182,7 +182,7 @@ TRACE_EVENT(target_cmd_complete,
),

TP_fast_assign(
__entry->unpacked_lun = cmd->se_lun->unpacked_lun;
__entry->unpacked_lun = cmd->orig_fe_lun;
__entry->opcode = cmd->t_task_cdb[0];
__entry->data_length = cmd->data_length;
__entry->task_attribute = cmd->sam_task_attr;
Expand Down

0 comments on commit 2053a1d

Please sign in to comment.