diff mbox

[v2,10/22] IB/srpt: Do not complain about initiator names without leading "0x"

Message ID 56ABF26F.4010509@sandisk.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Jan. 29, 2016, 11:14 p.m. UTC
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@sandisk.com>
Fixes: f246c941549c ("ib_srpt: Convert acl lookup to modern get_initiator_node_acl usage")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

Comments

Bart Van Assche Jan. 30, 2016, 1:57 a.m. UTC | #1
(added Nic to CC-list)

On 01/29/16 15:14, Bart Van Assche wrote:
> 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@sandisk.com>
> Fixes: f246c941549c ("ib_srpt: Convert acl lookup to modern get_initiator_node_acl usage")
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Sagi Grimberg <sagig@mellanox.com>
> Cc: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
>   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);
>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig Feb. 2, 2016, 11 a.m. UTC | #2
On Fri, Jan 29, 2016 at 03:14:55PM -0800, Bart Van Assche wrote:
> Only log an error message if neither the lookup with leading "0x"
> nor the lookup without leading "0x" succeeds.

Looks fine to me, but this is going to conflict with some work in
Nic's tree.  Maybe it's better to ?kip this one for now?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Estrin, Alex Feb. 2, 2016, 3:33 p.m. UTC | #3
TG9va3MgZmluZSB0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V0X2luaXRp
YXRvcl9ub2RlX2FjbCgmc3BvcnQtPnBvcnRfdHBnXzEsDQo+ICsJCQkJCQkgJmNoLT5zZXNzX25h
bWVbMF0pOw0KPiArCS8qIElmIG5vIG1hdGNoLCByZXRyeSB3aXRob3V0IGxlYWRpbmcgJzB4Jy4g
Ki8NCj4gKwlpZiAoIXNlX2FjbCkNCj4gKwkJc2VfYWNsID0gY29yZV90cGdfZ2V0X2luaXRpYXRv
cl9ub2RlX2FjbCgmc3BvcnQtPnBvcnRfdHBnXzEsDQo+ICsJCQkJCQkJICZjaC0+c2Vzc19uYW1l
WzJdKTsNCj4gIAlpZiAoIXNlX2FjbCkgew0KPiAgCQlwcl9pbmZvKCJSZWplY3RlZCBsb2dpbiBi
ZWNhdXNlIG5vIEFDTCBoYXMgYmVlbiINCj4gIAkJCSIgY29uZmlndXJlZCB5ZXQgZm9yIGluaXRp
YXRvciAlcy5cbiIsIGNoLT5zZXNzX25hbWUpOw0KPiAtCQkvKg0KPiAtCQkgKiBYWFg6IEhhY2sg
dG8gcmV0cnkgb2YgY2gtPmlfcG9ydF9pZCB3aXRob3V0IGxlYWRpbmcgJzB4Jw0KPiAtCQkgKi8N
Cj4gLQkJaWYgKHAgPT0gJmNoLT5zZXNzX25hbWVbMF0pIHsNCj4gLQkJCXAgKz0gMjsNCj4gLQkJ
CWdvdG8gdHJ5X2FnYWluOw0KPiAtCQl9DQo+ICAJCXJlai0+cmVhc29uID0gY3B1X3RvX2JlMzIo
DQo+ICAJCQkJU1JQX0xPR0lOX1JFSl9DSEFOTkVMX0xJTUlUX1JFQUNIRUQpOw0KPiAgCQl0cmFu
c3BvcnRfZnJlZV9zZXNzaW9uKGNoLT5zZXNzKTsNCj4gLS0NCj4gMi43LjANCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);