summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/iscsi_err.h2
-rw-r--r--usr/initiator.c16
-rw-r--r--usr/iscsi_err.c1
3 files changed, 18 insertions, 1 deletions
diff --git a/include/iscsi_err.h b/include/iscsi_err.h
index 506bd8c..ed000dd 100644
--- a/include/iscsi_err.h
+++ b/include/iscsi_err.h
@@ -68,6 +68,8 @@ enum {
ISCSI_ERR_UNKNOWN_DISCOVERY_TYPE = 30,
/* child process terminated */
ISCSI_ERR_CHILD_TERMINATED = 31,
+ /* session likely not connected */
+ ISCSI_ERR_SESSION_NOT_CONNECTED = 32,
/* Always last. Indicates end of error code space */
ISCSI_MAX_ERR_VAL,
diff --git a/usr/initiator.c b/usr/initiator.c
index a86d1e6..935056a 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2056,8 +2056,22 @@ int session_logout_task(int sid, queue_task_t *qtask)
return ISCSI_ERR_SESS_NOT_FOUND;
}
conn = &session->conn[0];
+
+ /*
+ * If syncing up, in XPT_WAIT, and REOPENing, then return
+ * an informative error, since the target for this session
+ * is likely not connected
+ */
+ if (session->notify_qtask &&
+ (conn->state == ISCSI_CONN_STATE_XPT_WAIT) &&
+ (session->r_stage == R_STAGE_SESSION_REOPEN)) {
+ log_warning("session cannot be terminted because it's trying to reconnect: try again later");
+ return ISCSI_ERR_SESSION_NOT_CONNECTED;
+ }
+
/*
- * If syncing up or if this is the initial login and mgmt_ipc
+ * If syncing up and not reconnecting,
+ * or if this is the initial login and mgmt_ipc
* has not been notified of that result fail the logout request
*/
if (session->notify_qtask ||
diff --git a/usr/iscsi_err.c b/usr/iscsi_err.c
index 1ba9e64..23c61fc 100644
--- a/usr/iscsi_err.c
+++ b/usr/iscsi_err.c
@@ -54,6 +54,7 @@ static char *iscsi_err_msgs[] = {
/* 29 */ "operation failed but retry may succeed",
/* 30 */ "unknown discovery type",
/* 31 */ "child process terminated",
+ /* 32 */ "target likely not connected",
};
char *iscsi_err_to_str(int err)