From 812d55d343f7d910e8933b7489e21d4fbef78afd Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 16 Apr 2015 11:10:32 +0200 Subject: [PATCH 1/3] socket: do not show misleading disconnect message if we are not actually logged in Signed-off-by: Peter Lieven --- lib/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/socket.c b/lib/socket.c index 5e76055..047a791 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -377,7 +377,7 @@ iscsi_disconnect(struct iscsi_context *iscsi) close(iscsi->fd); - if (iscsi->connected_portal[0]) { + if (!iscsi->pending_reconnect && iscsi->connected_portal[0]) { ISCSI_LOG(iscsi, 2, "disconnected from portal %s",iscsi->connected_portal); } From 1bb06b337ba69c7154bd29f562dc7f0210a6de50 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 16 Apr 2015 11:07:40 +0200 Subject: [PATCH 2/3] login: log successful logout Signed-off-by: Peter Lieven --- lib/login.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/login.c b/lib/login.c index f0e8be4..7a2ed89 100644 --- a/lib/login.c +++ b/lib/login.c @@ -1304,6 +1304,7 @@ struct iscsi_in_pdu *in) iscsi_adjust_maxexpcmdsn(iscsi, in); iscsi->is_loggedin = 0; + ISCSI_LOG(iscsi, 2, "logout successful"); pdu->callback(iscsi, SCSI_STATUS_GOOD, NULL, pdu->private_data); return 0; From e4a448b11542471b0af52bfc2442efccd6a948ce Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 16 Apr 2015 11:19:09 +0200 Subject: [PATCH 3/3] init: don't close fd of iscsi->old_iscsi its already closed at this point Signed-off-by: Peter Lieven --- lib/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/init.c b/lib/init.c index a6312d7..1648e59 100644 --- a/lib/init.c +++ b/lib/init.c @@ -337,7 +337,10 @@ iscsi_destroy_context(struct iscsi_context *iscsi) ISCSI_LOG(iscsi,5,"memory is clean at iscsi_destroy_context() after %d mallocs, %d realloc(s), %d free(s) and %d reused small allocations",iscsi->mallocs,iscsi->reallocs,iscsi->frees,iscsi->smallocs); } - iscsi_destroy_context(iscsi->old_iscsi); + if (iscsi->old_iscsi) { + iscsi->old_iscsi->fd = -1; + iscsi_destroy_context(iscsi->old_iscsi); + } memset(iscsi, 0, sizeof(struct iscsi_context)); free(iscsi);