ibmvscsis: Use tpgt passed in by user
authorBryant G. Ly <bryantly@linux.vnet.ibm.com>
Tue, 6 Jun 2017 20:45:49 +0000 (15:45 -0500)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 7 Jul 2017 06:11:28 +0000 (23:11 -0700)
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.

Signed-off-by: Bryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c

index 35710524d059d047844dc3d495662392d673bcab..522d547d9fea13e3525d255a922da2aa96d34706 100644 (file)
@@ -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,