Message ID | 20200510215744.21999-2-mchristi@redhat.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | target: add sysfs support | expand |
On 5/10/20 11:57 PM, Mike Christie wrote: > 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 5th patch is built on top. > > Signed-off-by: Mike Christie <mchristi@redhat.com> > --- > drivers/target/target_core_pr.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes
On 5/10/20 2:57 PM, Mike Christie wrote: > 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 5th patch is built on top. > > Signed-off-by: Mike Christie <mchristi@redhat.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); > Reviewed-by: Lee Duncan <lduncan@suse.com>
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);
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 5th patch is built on top. Signed-off-by: Mike Christie <mchristi@redhat.com> --- drivers/target/target_core_pr.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)