From: Mike Christie <michael.christie@oracle.com> To: bvanassche@acm.org, bstroesser@ts.fujitsu.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH 01/17] target: check enforce_pr_isids during registration Date: Sun, 07 Jun 2020 20:35:48 +0000 [thread overview] Message-ID: <1591562164-9766-2-git-send-email-michael.christie@oracle.com> (raw) In-Reply-To: <1591562164-9766-1-git-send-email-michael.christie@oracle.com> Move the check for enforce_pr_isids to the registration code where we can fail at the time an initiator tries to register a path without an isid. In its current place in __core_scsi3_locate_pr_reg, it is too late because it can be registered and be reported in PR in commands and it is stuck in this state because we cannot unregister it. Note. I am including in this patchset, because the 9th patch is built on top. Signed-off-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Lee Duncan <lduncan@suse.com> --- drivers/target/target_core_pr.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 5e93169..cd2d32f 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -1176,15 +1176,6 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg( * ISID, then we have found a match. */ if (!pr_reg->isid_present_at_reg) { - /* - * Determine if this SCSI device server requires that - * SCSI Intiatior TransportID w/ ISIDs is enforced - * for fabric modules (iSCSI) requiring them. - */ - if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) { - if (dev->dev_attrib.enforce_pr_isids) - continue; - } atomic_inc_mb(&pr_reg->pr_res_holders); spin_unlock(&pr_tmpl->registration_lock); return pr_reg; @@ -1591,10 +1582,25 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) continue; dest_rtpi = tmp_lun->lun_rtpi; + iport_ptr = NULL; i_str = target_parse_pr_out_transport_id(tmp_tpg, ptr, &tid_len, &iport_ptr); if (!i_str) continue; + /* + * Determine if this SCSI device server requires that + * SCSI Intiatior TransportID w/ ISIDs is enforced + * for fabric modules (iSCSI) requiring them. + */ + if (tpg->se_tpg_tfo->sess_get_initiator_sid && + dev->dev_attrib.enforce_pr_isids && + !iport_ptr) { + pr_warn("SPC-PR: enforce_pr_isids is set but a isid has not been sent in the SPEC_I_PT data for %s.", + i_str); + ret = TCM_INVALID_PARAMETER_LIST; + spin_unlock(&dev->se_port_lock); + goto out_unmap; + } atomic_inc_mb(&tmp_tpg->tpg_pr_ref_count); spin_unlock(&dev->se_port_lock); -- 1.8.3.1
WARNING: multiple messages have this Message-ID (diff)
From: Mike Christie <michael.christie@oracle.com> To: bvanassche@acm.org, bstroesser@ts.fujitsu.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH 01/17] target: check enforce_pr_isids during registration Date: Sun, 7 Jun 2020 15:35:48 -0500 [thread overview] Message-ID: <1591562164-9766-2-git-send-email-michael.christie@oracle.com> (raw) In-Reply-To: <1591562164-9766-1-git-send-email-michael.christie@oracle.com> Move the check for enforce_pr_isids to the registration code where we can fail at the time an initiator tries to register a path without an isid. In its current place in __core_scsi3_locate_pr_reg, it is too late because it can be registered and be reported in PR in commands and it is stuck in this state because we cannot unregister it. Note. I am including in this patchset, because the 9th patch is built on top. Signed-off-by: Mike Christie <michael.christie@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Lee Duncan <lduncan@suse.com> --- drivers/target/target_core_pr.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index 5e93169..cd2d32f 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c @@ -1176,15 +1176,6 @@ static struct t10_pr_registration *__core_scsi3_locate_pr_reg( * ISID, then we have found a match. */ if (!pr_reg->isid_present_at_reg) { - /* - * Determine if this SCSI device server requires that - * SCSI Intiatior TransportID w/ ISIDs is enforced - * for fabric modules (iSCSI) requiring them. - */ - if (tpg->se_tpg_tfo->sess_get_initiator_sid != NULL) { - if (dev->dev_attrib.enforce_pr_isids) - continue; - } atomic_inc_mb(&pr_reg->pr_res_holders); spin_unlock(&pr_tmpl->registration_lock); return pr_reg; @@ -1591,10 +1582,25 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) continue; dest_rtpi = tmp_lun->lun_rtpi; + iport_ptr = NULL; i_str = target_parse_pr_out_transport_id(tmp_tpg, ptr, &tid_len, &iport_ptr); if (!i_str) continue; + /* + * Determine if this SCSI device server requires that + * SCSI Intiatior TransportID w/ ISIDs is enforced + * for fabric modules (iSCSI) requiring them. + */ + if (tpg->se_tpg_tfo->sess_get_initiator_sid && + dev->dev_attrib.enforce_pr_isids && + !iport_ptr) { + pr_warn("SPC-PR: enforce_pr_isids is set but a isid has not been sent in the SPEC_I_PT data for %s.", + i_str); + ret = TCM_INVALID_PARAMETER_LIST; + spin_unlock(&dev->se_port_lock); + goto out_unmap; + } atomic_inc_mb(&tmp_tpg->tpg_pr_ref_count); spin_unlock(&dev->se_port_lock); -- 1.8.3.1
next prev parent reply other threads:[~2020-06-07 20:35 UTC|newest] Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-07 20:35 [PATCH v6 00/17] target: add sysfs support Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` Mike Christie [this message] 2020-06-07 20:35 ` [PATCH 01/17] target: check enforce_pr_isids during registration Mike Christie 2020-06-07 20:35 ` [PATCH 02/17] target: separate acl name from port ids Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-09 10:11 ` Stefan Hajnoczi 2020-06-09 10:11 ` Stefan Hajnoczi 2020-06-09 14:13 ` Himanshu Madhani 2020-06-09 14:13 ` Himanshu Madhani 2020-06-07 20:35 ` [PATCH 03/17] target: add helper to parse acl and transport name Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 04/17] tcm loop: use target_parse_emulated_name Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 05/17] vhost scsi: " Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-09 10:21 ` Stefan Hajnoczi 2020-06-09 10:21 ` Stefan Hajnoczi 2020-06-07 20:35 ` [PATCH 06/17] xen scsiback: " Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 07/17] iscsi target: setup transport_id Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 08/17] target: use tpt_id in target_stat_iport_port_ident_show Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 09/17] target: drop sess_get_initiator_sid from PR code Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 10/17] target: drop sess_get_initiator_sid Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-07 20:35 ` [PATCH 11/17] target: add session sysfs class support Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-08 5:32 ` Greg Kroah-Hartman 2020-06-08 5:32 ` Greg Kroah-Hartman 2020-06-08 15:35 ` Mike Christie 2020-06-08 15:35 ` Mike Christie 2020-06-08 16:36 ` Greg Kroah-Hartman 2020-06-08 16:36 ` Greg Kroah-Hartman 2020-06-08 19:02 ` Mike Christie 2020-06-08 19:02 ` Mike Christie 2020-06-09 6:05 ` Greg Kroah-Hartman 2020-06-09 6:05 ` Greg Kroah-Hartman 2020-06-08 6:14 ` Hannes Reinecke 2020-06-08 6:14 ` Hannes Reinecke 2020-06-08 15:21 ` Mike Christie 2020-06-08 15:21 ` Mike Christie 2020-06-08 15:55 ` Michael Christie 2020-06-08 15:55 ` Michael Christie 2020-06-09 3:10 ` Michael Christie 2020-06-09 3:10 ` Michael Christie 2020-06-08 12:06 ` Bodo Stroesser 2020-06-08 12:06 ` Bodo Stroesser 2020-06-08 14:49 ` Mike Christie 2020-06-08 14:49 ` Mike Christie 2020-06-08 12:18 ` Greg Kroah-Hartman 2020-06-08 12:18 ` Greg Kroah-Hartman 2020-06-08 12:18 ` Greg Kroah-Hartman 2020-06-08 12:18 ` Greg Kroah-Hartman 2020-06-07 20:35 ` [PATCH 12/17] target: hook most target users into sysfs API Mike Christie 2020-06-07 20:35 ` Mike Christie 2020-06-08 6:15 ` Hannes Reinecke 2020-06-08 6:15 ` Hannes Reinecke 2020-06-08 10:20 ` kernel test robot 2020-06-08 10:20 ` kernel test robot 2020-06-08 10:20 ` kernel test robot 2020-06-07 20:36 ` [PATCH 13/17] iscsi target: replace module sids with lio's sid Mike Christie 2020-06-07 20:36 ` Mike Christie 2020-06-08 6:16 ` Hannes Reinecke 2020-06-08 6:16 ` Hannes Reinecke 2020-06-07 20:36 ` [PATCH 14/17] target: add free_session callout Mike Christie 2020-06-07 20:36 ` Mike Christie 2020-06-08 6:19 ` Hannes Reinecke 2020-06-08 6:19 ` Hannes Reinecke 2020-06-07 20:36 ` [PATCH 15/17] iscsi target: hook iscsi target into sysfs API Mike Christie 2020-06-07 20:36 ` Mike Christie 2020-06-08 6:20 ` Hannes Reinecke 2020-06-08 6:20 ` Hannes Reinecke 2020-06-07 20:36 ` [PATCH 16/17] iscsi target: export session state and alias in sysfs Mike Christie 2020-06-07 20:36 ` Mike Christie 2020-06-08 6:21 ` Hannes Reinecke 2020-06-08 6:21 ` Hannes Reinecke 2020-06-07 20:36 ` [PATCH 17/17] target: drop sess_get_index Mike Christie 2020-06-07 20:36 ` Mike Christie 2020-06-08 6:21 ` Hannes Reinecke 2020-06-08 6:21 ` Hannes Reinecke
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1591562164-9766-2-git-send-email-michael.christie@oracle.com \ --to=michael.christie@oracle.com \ --cc=bstroesser@ts.fujitsu.com \ --cc=bvanassche@acm.org \ --cc=linux-scsi@vger.kernel.org \ --cc=martin.petersen@oracle.com \ --cc=target-devel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.