target: Fix assignment of LUN in tracepoints
authorRoland Dreier <roland@purestorage.com>
Tue, 8 Oct 2013 16:47:22 +0000 (09:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Nov 2013 03:08:09 +0000 (12:08 +0900)
commit246d77a83ed063b021484961e3e2a67096231640
treeab03b1efd5254b1455dbf07187140e52db3d03e1
parent790c6e06934c132f5bdbce4fbf791236272f9763
target: Fix assignment of LUN in tracepoints

commit 2053a1db41193c2b5e1f47a91aaba0fd63ba7102 upstream.

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>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/trace/events/target.h