[stgt] [PATCH V1] iser: Don't release IB resources if were not allocated

Roi Dayan roid at mellanox.com
Sun Aug 25 13:20:39 CEST 2013


The lld exit function is being called even if the lld was not
initialized.
Added a check if IB resources were allocated before trying to
release.

Signed-off-by: Roi Dayan <roid at mellanox.com>
---

Hi Tomo,

This is instead of the previus one.
I added more information to the commit message.

This patch should be applied over Andy's patch:
[PATCH] iser: Don't wait until iser_ib_init to init list_heads

Thanks,
Roi

 usr/iscsi/iser.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/usr/iscsi/iser.c b/usr/iscsi/iser.c
index be2afeb..3e96cb7 100644
--- a/usr/iscsi/iser.c
+++ b/usr/iscsi/iser.c
@@ -3408,13 +3408,15 @@ static void iser_ib_release(void)
 		free(dev);
 	}
 
-	tgt_event_del(cma_listen_id->channel->fd);
+	if (cma_listen_id) {
+		tgt_event_del(cma_listen_id->channel->fd);
 
-	err = rdma_destroy_id(cma_listen_id);
-	if (err)
-		eprintf("rdma_destroy_id failed: (errno=%d %m)\n", errno);
+		err = rdma_destroy_id(cma_listen_id);
+		if (err)
+			eprintf("rdma_destroy_id failed: (errno=%d %m)\n", errno);
 
-	rdma_destroy_event_channel(rdma_evt_channel);
+		rdma_destroy_event_channel(rdma_evt_channel);
+	}
 }
 
 static int iser_send_nop = 1;
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list