Skip to contentSkip to conversation

ibmvscsis: Use tpgt passed in by user

PATCH Applied Bryant G. Ly 2 participants 2 messages Jun 6, 2017 – Jun 9, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ibmvscsis: Use tpgt passed in by user

ibmvscsis always returned 0 for the tpg/tag, since it did not parse the value passed in by the user.

When functions like ALUA members exports the value, it will be incorrect because targetcli/rtslib starts the tpg numbering at 1.

---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +8 -0
index 3571052..522d547 100644
@@ -3914,8 +3914,16 @@ static struct se_portal_group *ibmvscsis_make_tpg(struct se_wwn *wwn,
 {
 	struct ibmvscsis_tport *tport =
 		container_of(wwn, struct ibmvscsis_tport, tport_wwn);
+	u16 tpgt;
 	int rc;
 
+	if (strstr(name, "tpgt_") != name)
+		return ERR_PTR(-EINVAL);
+	rc = kstrtou16(name + 5, 0, &tpgt);
+	if (rc)
+		return ERR_PTR(rc);
+	tport->tport_tpgt = tpgt;
+
 	tport->releasing = false;
 
 	rc = core_tpg_register(&tport->tport_wwn, &tport->se_tpg,
Signature · 1 line
2.5.4 (Apple Git-61)
#1 lore raw
Quoted 7 lines · Bryant G. Ly

ibmvscsis always returned 0 for the tpg/tag, since it did not parse the value passed in by the user.

When functions like ALUA members exports the value, it will be incorrect because targetcli/rtslib starts the tpg numbering at 1.

Quoted 5 lines
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Applied to target-pending/for-next.

Thanks Bryant + MNC.