All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Doug Ledford <dledford@redhat.com>
Cc: "Nicholas A. Bellinger" <nab@linux-iscsi.org>,
	Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	target-devel <target-devel@vger.kernel.org>
Subject: [PATCH 2/4] IB/srpt: Report login failures only once
Date: Wed, 6 Apr 2016 11:57:03 -0700	[thread overview]
Message-ID: <57055BFF.9060607@sandisk.com> (raw)
In-Reply-To: <57055BC6.7070402@sandisk.com>

Report the following message only once if no ACL has been configured
yet for an initiator port:

"Rejected login because no ACL has been configured yet for initiator %s.\n"

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagig@mellanox.com>
---
 drivers/infiniband/ulp/srpt/ib_srpt.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 3b425af..07dfc50 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2028,7 +2028,6 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
 	struct srpt_rdma_ch *ch, *tmp_ch;
 	u32 it_iu_len;
 	int i, ret = 0;
-	unsigned char *p;
 
 	WARN_ON_ONCE(irqs_disabled());
 
@@ -2182,21 +2181,18 @@ 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];
 
-try_again:
 	ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0,
-					TARGET_PROT_NORMAL, p, ch, NULL);
+					TARGET_PROT_NORMAL, ch->sess_name, ch,
+					NULL);
+	/* Retry without leading "0x" */
+	if (IS_ERR(ch->sess))
+		ch->sess = target_alloc_session(&sport->port_tpg_1, 0, 0,
+						TARGET_PROT_NORMAL,
+						ch->sess_name + 2, ch, NULL);
 	if (IS_ERR(ch->sess)) {
-		pr_info("Rejected login because no ACL has been"
-			" configured yet for initiator %s.\n", p);
-		/*
-		 * XXX: Hack to retry of ch->i_port_id without leading '0x'
-		 */
-		if (p == &ch->sess_name[0]) {
-			p += 2;
-			goto try_again;
-		}
+		pr_info("Rejected login because no ACL has been configured yet for initiator %s.\n",
+			ch->sess_name);
 		rej->reason = cpu_to_be32((PTR_ERR(ch->sess) == -ENOMEM) ?
 				SRP_LOGIN_REJ_INSUFFICIENT_RESOURCES :
 				SRP_LOGIN_REJ_CHANNEL_LIMIT_REACHED);
-- 
2.7.4

  parent reply	other threads:[~2016-04-06 18:57 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-06 18:56 [PATCH 0/4] IB/srpt and the percpu_ida conversion Bart Van Assche
2016-04-06 18:56 ` [PATCH 1/4] IB/srpt: Revert "Convert to percpu_ida tag allocation" Bart Van Assche
2016-04-06 18:57 ` Bart Van Assche [this message]
     [not found]   ` <57055BFF.9060607-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-07 13:40     ` [PATCH 2/4] IB/srpt: Report login failures only once Christoph Hellwig
2016-04-06 18:57 ` [PATCH 3/4] IB/srpt: Introduce two helper functions Bart Van Assche
2016-04-07 13:40   ` Christoph Hellwig
2016-04-07 22:29 ` [PATCH 0/4] IB/srpt and the percpu_ida conversion Nicholas A. Bellinger
     [not found]   ` <1460068181.18732.23.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 22:38     ` Bart Van Assche
2016-04-07 23:01   ` Christoph Hellwig
     [not found]     ` <20160407230110.GA9842-jcswGhMUV9g@public.gmane.org>
2016-04-07 23:24       ` Nicholas A. Bellinger
2016-04-07 23:34         ` Bart Van Assche
2016-04-07 23:47           ` Nicholas A. Bellinger
2016-04-07 23:49             ` Bart Van Assche
2016-04-08  8:16           ` Jack Wang
     [not found]         ` <1460071464.18732.57.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:47           ` Bart Van Assche
     [not found] ` <57055BC6.7070402-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-06 18:57   ` [PATCH 4/4] IB/srpt: Convert to percpu_ida tag allocation Bart Van Assche
2016-04-07 13:43     ` Christoph Hellwig
2016-04-07 23:03     ` Christoph Hellwig
2016-04-07 23:31       ` Nicholas A. Bellinger
2016-04-07 22:55   ` [PATCH] IB/srpt: Revert "Convert to percpu_ida tag allocation" Bart Van Assche
2016-04-07 23:37     ` Nicholas A. Bellinger
     [not found]       ` <1460072224.18732.67.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:44         ` Bart Van Assche
     [not found]           ` <5706F0E8.5020705-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-07 23:52             ` Nicholas A. Bellinger
     [not found]               ` <1460073123.18732.80.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-07 23:54                 ` Christoph Hellwig
2016-04-08  0:00                   ` Nicholas A. Bellinger
2016-04-08  0:00                 ` Doug Ledford
2016-04-07 23:49       ` Linus Torvalds
     [not found]         ` <CA+55aFwOnCeKzg4SuceZm98DgN-tV7aCdtrenAS93LP7GqrZtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-07 23:56           ` Nicholas A. Bellinger
     [not found]             ` <1460073392.18732.83.camel-XoQW25Eq2zviZyQQd+hFbcojREIfoBdhmpATvIKMPHk@public.gmane.org>
2016-04-08  0:13               ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57055BFF.9060607@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=dledford@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-rdma@vger.kernel.org \
    --cc=nab@linux-iscsi.org \
    --cc=sagi@grimberg.me \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.