iscsi: Use cached host and port name of connection widely

portal_host and portal_name were added to struct spdk_iscsi_conn long
ago but had not been used yet. Portal group and its portals can be
removed dynamically even if there is any binded connection. Using
cached pg_tag will avoid potential errors.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I56d02664a3e8b2398bbb9162b1c85856e991b5b4
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463879
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-08-05 17:36:39 +09:00 committed by Jim Harris
parent f338b43a86
commit 7877ddc86e
2 changed files with 5 additions and 6 deletions

View File

@ -1701,7 +1701,6 @@ iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
const char *val;
int rc = 0;
struct spdk_iscsi_tgt_node *target = conn->target;
struct spdk_iscsi_portal *portal = conn->portal;
/* declarative parameters */
if (target != NULL) {
@ -1718,7 +1717,7 @@ iscsi_op_login_set_target_info(struct spdk_iscsi_conn *conn,
return SPDK_ISCSI_LOGIN_ERROR_PARAMETER;
}
}
snprintf(buf, sizeof buf, "%s:%s,%d", portal->host, portal->port,
snprintf(buf, sizeof buf, "%s:%s,%d", conn->portal_host, conn->portal_port,
conn->pg_tag);
rc = spdk_iscsi_param_set(conn->sess->params, "TargetAddress", buf);
if (rc < 0) {
@ -2082,7 +2081,7 @@ iscsi_op_login_notify_session_info(struct spdk_iscsi_conn *conn,
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
conn->initiator_name, conn->initiator_addr,
conn->target->name, conn->target->num,
conn->portal->host, conn->portal->port, conn->pg_tag,
conn->portal_host, conn->portal_port, conn->pg_tag,
conn->sess->isid, conn->sess->tsih, conn->cid,
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
? "on" : "off"),
@ -2094,7 +2093,7 @@ iscsi_op_login_notify_session_info(struct spdk_iscsi_conn *conn,
" (%s:%s,%d), ISID=%"PRIx64", TSIH=%u,"
" CID=%u, HeaderDigest=%s, DataDigest=%s\n",
conn->initiator_name, conn->initiator_addr,
conn->portal->host, conn->portal->port, conn->pg_tag,
conn->portal_host, conn->portal_port, conn->pg_tag,
conn->sess->isid, conn->sess->tsih, conn->cid,
(spdk_iscsi_param_eq_val(conn->params, "HeaderDigest", "CRC32C")
? "on" : "off"),

View File

@ -267,8 +267,8 @@ spdk_iscsi_tgt_node_access(struct spdk_iscsi_conn *conn,
denied:
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "access denied from %s (%s) to %s (%s:%s,%d)\n",
iqn, addr, target->name, conn->portal->host,
conn->portal->port, conn->pg_tag);
iqn, addr, target->name, conn->portal_host,
conn->portal_port, conn->pg_tag);
return false;
}