reconnect: avoid deadlock if socker error is received during reconnect

If we are reconnecting and the connection is already established we
end up looping forever if there is a socket error before we finish
the login process. Fix this by invoking the reconnect callback if
there is an error and no new reconnect is scheduled.

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-04-13 12:08:08 +02:00
parent e219f1bb97
commit 913b2ab708
3 changed files with 8 additions and 2 deletions

View File

@@ -367,6 +367,9 @@ uint32_t iscsi_itt_post_increment(struct iscsi_context *iscsi);
void iscsi_timeout_scan(struct iscsi_context *iscsi);
void iscsi_reconnect_cb(struct iscsi_context *iscsi _U_, int status,
void *command_data, void *private_data);
#ifdef __cplusplus
}
#endif

View File

@@ -249,8 +249,8 @@ void iscsi_defer_reconnect(struct iscsi_context *iscsi)
}
}
static void iscsi_reconnect_cb(struct iscsi_context *iscsi _U_, int status,
void *command_data _U_, void *private_data _U_)
void iscsi_reconnect_cb(struct iscsi_context *iscsi _U_, int status,
void *command_data _U_, void *private_data _U_)
{
int i;
if (status != SCSI_STATUS_GOOD) {

View File

@@ -780,6 +780,9 @@ iscsi_service_reconnect_if_loggedin(struct iscsi_context *iscsi)
}
}
if (iscsi->old_iscsi) {
if (!iscsi->pending_reconnect) {
iscsi_reconnect_cb(iscsi, SCSI_STATUS_ERROR, NULL, NULL);
}
return 0;
}
return -1;