On Sun, 2012-05-20 at 14:35 -0400, Christoph Hellwig wrote: > Also remove the unused ref_task_lun field in struct se_tmr_req. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > This cleanup looks reasonable to me. Comments below.. > Index: lio-core/drivers/target/iscsi/iscsi_target_tmr.c > =================================================================== > --- lio-core.orig/drivers/target/iscsi/iscsi_target_tmr.c 2012-04-21 10:38:00.619921429 +0200 > +++ lio-core/drivers/target/iscsi/iscsi_target_tmr.c 2012-05-20 20:09:16.152069731 +0200 > @@ -61,7 +61,7 @@ u8 iscsit_tmr_abort_task( > } > > se_tmr->ref_task_tag = hdr->rtt; > - se_tmr->ref_cmd = &ref_cmd->se_cmd; > + tmr_req->ref_cmd = ref_cmd; > tmr_req->ref_cmd_sn = hdr->refcmdsn; > tmr_req->exp_data_sn = hdr->exp_datasn; > > @@ -156,8 +156,7 @@ u8 iscsit_tmr_task_reassign( > } > > se_tmr->ref_task_tag = hdr->rtt; > - se_tmr->ref_cmd = &ref_cmd->se_cmd; > - se_tmr->ref_task_lun = get_unaligned_le64(&hdr->lun); > + tmr_req->ref_cmd = ref_cmd; > tmr_req->ref_cmd_sn = hdr->refcmdsn; > tmr_req->exp_data_sn = hdr->exp_datasn; > tmr_req->conn_recovery = cr; > Index: lio-core/include/target/target_core_base.h > =================================================================== > --- lio-core.orig/include/target/target_core_base.h 2012-05-20 20:00:37.888056464 +0200 > +++ lio-core/include/target/target_core_base.h 2012-05-20 20:09:03.872069419 +0200 > @@ -484,10 +484,8 @@ struct se_tmr_req { > /* Reference to ITT that Task Mgmt should be performed */ > u32 ref_task_tag; > /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */ > - u64 ref_task_lun; Ok, the TASK_REASSIGN should actually be checking it's ref_task_lun vs. ref_cmd->orig_fe_lun to ensure this iSCSI specific TMR is being executed on the same LUNs before processing. I'm squashing the following incremental patch to address this on top of your original for 3.6-queue: diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 639e036..63a8ed2 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h @@ -480,8 +480,8 @@ struct iscsi_cmd { struct iscsi_tmr_req { bool task_reassign:1; u32 ref_cmd_sn; - struct iscsi_cmd *ref_cmd; u32 exp_data_sn; + struct iscsi_cmd *ref_cmd; struct iscsi_conn_recovery *conn_recovery; struct se_tmr_req *se_tmr_req; }; diff --git a/drivers/target/iscsi/iscsi_target_tmr.c b/drivers/target/iscsi/iscsi_target_tmr.c index e50a569..1f75529 100644 --- a/drivers/target/iscsi/iscsi_target_tmr.c +++ b/drivers/target/iscsi/iscsi_target_tmr.c @@ -19,6 +19,7 @@ ******************************************************************************/ #include <asm/unaligned.h> +#include <scsi/scsi_device.h> #include <scsi/iscsi_proto.h> #include <target/target_core_base.h> #include <target/target_core_fabric.h> @@ -121,7 +122,7 @@ u8 iscsit_tmr_task_reassign( struct iscsi_tmr_req *tmr_req = cmd->tmr_req; struct se_tmr_req *se_tmr = cmd->se_cmd.se_tmr_req; struct iscsi_tm *hdr = (struct iscsi_tm *) buf; - int ret; + int ret, ref_lun; pr_debug("Got TASK_REASSIGN TMR ITT: 0x%08x," " RefTaskTag: 0x%08x, ExpDataSN: 0x%08x, CID: %hu\n", @@ -155,6 +156,14 @@ u8 iscsit_tmr_task_reassign( return ISCSI_TMF_RSP_REJECTED; } + ref_lun = scsilun_to_int(&hdr->lun); + if (ref_lun != ref_cmd->se_cmd.orig_fe_lun) { + pr_err("Unable to perform connection recovery for" + " differing ref_lun: %d ref_cmd orig_fe_lun: %u\n", + ref_lun, ref_cmd->se_cmd.orig_fe_lun); + return ISCSI_TMF_RSP_REJECTED; + } + se_tmr->ref_task_tag = hdr->rtt; tmr_req->ref_cmd = ref_cmd; tmr_req->ref_cmd_sn = hdr->refcmdsn; diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 41303ee..3df2fd9 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -483,7 +483,6 @@ struct se_tmr_req { int call_transport; /* Reference to ITT that Task Mgmt should be performed */ u32 ref_task_tag; - /* 64-bit encoded SAM LUN from $FABRIC_MOD TMR header */ void *fabric_tmr_ptr; struct se_cmd *task_cmd; struct se_device *tmr_dev; -- 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