提交 b42057ab 编写于 作者: N Nicholas Bellinger

ib_srpt: Convert to target_alloc_session usage

This patch converts ib_srpt internal assignments of
se_node_acl and transport_register_session() to use
the new alloc_session method.

Cc: Vu Pham <vu@mellanox.com>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 9ed59655
...@@ -2240,7 +2240,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2240,7 +2240,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
struct srp_login_rej *rej; struct srp_login_rej *rej;
struct ib_cm_rep_param *rep_param; struct ib_cm_rep_param *rep_param;
struct srpt_rdma_ch *ch, *tmp_ch; struct srpt_rdma_ch *ch, *tmp_ch;
struct se_node_acl *se_acl;
u32 it_iu_len; u32 it_iu_len;
int i, ret = 0; int i, ret = 0;
unsigned char *p; unsigned char *p;
...@@ -2406,19 +2405,12 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2406,19 +2405,12 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
pr_debug("registering session %s\n", ch->sess_name); pr_debug("registering session %s\n", ch->sess_name);
p = &ch->sess_name[0]; p = &ch->sess_name[0];
ch->sess = transport_init_session(TARGET_PROT_NORMAL);
if (IS_ERR(ch->sess)) {
rej->reason = cpu_to_be32(
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES);
pr_debug("Failed to create session\n");
goto destroy_ib;
}
try_again: try_again:
se_acl = core_tpg_get_initiator_node_acl(&sport->port_tpg_1, p); ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0,
if (!se_acl) { TARGET_PROT_NORMAL, p, ch, NULL);
if (IS_ERR(ch->sess)) {
pr_info("Rejected login because no ACL has been" pr_info("Rejected login because no ACL has been"
" configured yet for initiator %s.\n", ch->sess_name); " configured yet for initiator %s.\n", p);
/* /*
* XXX: Hack to retry of ch->i_port_id without leading '0x' * XXX: Hack to retry of ch->i_port_id without leading '0x'
*/ */
...@@ -2426,14 +2418,11 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, ...@@ -2426,14 +2418,11 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
p += 2; p += 2;
goto try_again; goto try_again;
} }
rej->reason = cpu_to_be32( rej->reason = cpu_to_be32((PTR_ERR(ch->sess) == -ENOMEM) ?
SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES :
SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED);
transport_free_session(ch->sess);
goto destroy_ib; goto destroy_ib;
} }
ch->sess->se_node_acl = se_acl;
transport_register_session(&sport->port_tpg_1, se_acl, ch->sess, ch);
pr_debug("Establish connection sess=%p name=%s cm_id=%p\n", ch->sess, pr_debug("Establish connection sess=%p name=%s cm_id=%p\n", ch->sess,
ch->sess_name, ch->cm_id); ch->sess_name, ch->cm_id);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册