public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Doug Ledford <dledford@redhat.com>
Cc: James Bottomley <jbottomley@odin.com>,
	Sagi Grimberg <sagig@mellanox.com>,
	Sebastian Parschauer <sebastian.riemer@profitbricks.com>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>
Subject: [PATCH v2 11/12] IB/srp: Remove !ch->target tests from the reconnect code
Date: Mon, 18 May 2015 13:26:17 +0200	[thread overview]
Message-ID: <5559CC59.8@sandisk.com> (raw)
In-Reply-To: <5559CB3A.6060102@sandisk.com>

Remove the !ch->target tests from the reconnect code. These
tests are not needed: upon entry of srp_rport_reconnect()
it is guaranteed that all ch->target pointers are non-NULL.
None of the functions srp_new_cm_id(), srp_finish_req(),
srp_create_ch_ib() nor srp_connect_ch() modifies this pointer.
srp_free_ch_ib() is never called concurrently with
srp_rport_reconnect().

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Cc: Sebastian Parschauer <sebastian.riemer@profitbricks.com>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index dd6f928..a0a2348 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1226,14 +1226,10 @@ static int srp_rport_reconnect(struct srp_rport *rport)
 	 */
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		ret += srp_new_cm_id(ch);
 	}
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		for (j = 0; j < target->req_ring_size; ++j) {
 			struct srp_request *req = &ch->req_ring[j];
 
@@ -1242,8 +1238,6 @@ static int srp_rport_reconnect(struct srp_rport *rport)
 	}
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (!ch->target)
-			break;
 		/*
 		 * Whether or not creating a new CM ID succeeded, create a new
 		 * QP. This guarantees that all completion callback function
@@ -1260,7 +1254,7 @@ static int srp_rport_reconnect(struct srp_rport *rport)
 
 	for (i = 0; i < target->ch_count; i++) {
 		ch = &target->ch[i];
-		if (ret || !ch->target)
+		if (ret)
 			break;
 		ret = srp_connect_ch(ch, multich);
 		multich = true;
-- 
2.1.4


  parent reply	other threads:[~2015-05-18 11:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18 11:21 [PATCH v2 00/12] IB/srp patches for kernel v4.2 Bart Van Assche
2015-05-18 11:22 ` [PATCH v2 01/12] scsi_transport_srp: Introduce srp_wait_for_queuecommand() Bart Van Assche
     [not found] ` <5559CB3A.6060102-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2015-05-18 11:22   ` [PATCH v2 02/12] scsi_transport_srp: Fix a race condition Bart Van Assche
2015-05-18 11:23   ` [PATCH v2 03/12] IB/srp: Remove an extraneous scsi_host_put() from an error path Bart Van Assche
2015-05-18 11:23   ` [PATCH v2 04/12] IB/srp: Fix a connection setup race Bart Van Assche
2015-05-18 11:23   ` [PATCH v2 05/12] IB/srp: Fix connection state tracking Bart Van Assche
2015-05-18 11:24   ` [PATCH v2 07/12] scsi_transport_srp: Reduce failover time Bart Van Assche
2015-05-18 11:25   ` [PATCH v2 09/12] IB/srp: Rearrange module description Bart Van Assche
2015-05-18 11:25   ` [PATCH v2 10/12] IB/srp: Remove a superfluous check from srp_free_req_data() Bart Van Assche
2015-05-18 11:24 ` [PATCH v2 06/12] IB/srp: Fix reconnection failure handling Bart Van Assche
2015-05-18 11:25 ` [PATCH v2 08/12] IB/srp: Remove superfluous casts Bart Van Assche
2015-05-18 11:26 ` Bart Van Assche [this message]
2015-05-18 11:27 ` [PATCH v2 12/12] IB/srp: Add 64-bit LUN support Bart Van Assche

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=5559CC59.8@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=dledford@redhat.com \
    --cc=jbottomley@odin.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sagig@mellanox.com \
    --cc=sebastian.riemer@profitbricks.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox