Only log an error message if neither the lookup with leading "0x" nor the lookup without leading "0x" succeeds. Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx> Fixes: f246c941549c ("ib_srpt: Convert acl lookup to modern get_initiator_node_acl usage") Cc: Christoph Hellwig <hch@xxxxxx> Cc: Sagi Grimberg <sagig@xxxxxxxxxxxx> Cc: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx> --- drivers/infiniband/ulp/srpt/ib_srpt.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index b46e8d7..d892736 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2042,7 +2042,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, struct se_node_acl *se_acl; u32 it_iu_len; int i, ret = 0; - unsigned char *p; WARN_ON_ONCE(irqs_disabled()); @@ -2200,7 +2199,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, be64_to_cpu(*(__be64 *)(ch->i_port_id + 8))); pr_debug("registering session %s\n", ch->sess_name); - p = &ch->sess_name[0]; ch->sess = transport_init_session(TARGET_PROT_NORMAL); if (IS_ERR(ch->sess)) { @@ -2210,18 +2208,15 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id, goto destroy_ib; } -try_again: - se_acl = core_tpg_get_initiator_node_acl(&sport->port_tpg_1, p); + se_acl = core_tpg_get_initiator_node_acl(&sport->port_tpg_1, + &ch->sess_name[0]); + /* If no match, retry without leading '0x'. */ + if (!se_acl) + se_acl = core_tpg_get_initiator_node_acl(&sport->port_tpg_1, + &ch->sess_name[2]); if (!se_acl) { pr_info("Rejected login because no ACL has been" " configured yet for initiator %s.\n", ch->sess_name); - /* - * XXX: Hack to retry of ch->i_port_id without leading '0x' - */ - if (p == &ch->sess_name[0]) { - p += 2; - goto try_again; - } rej->reason = cpu_to_be32( SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED); transport_free_session(ch->sess); -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html