add iscsi_force_reconnect()
If a connection attempt is hung, then iscsi_reconnect() won't do anything. This makes sense if we'd just re-try to connect to the same target, but if (for example) login redirect might point us to a different, healthy, target, it should be possible to restart the full connection process on request. Signed-off-by: John Levon <john.levon@nutanix.com>
This commit is contained in:
committed by
Bart Van Assche
parent
314aa26576
commit
30dd7c6429
16
lib/sync.c
16
lib/sync.c
@@ -226,6 +226,22 @@ int iscsi_reconnect_sync(struct iscsi_context *iscsi)
|
||||
return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
|
||||
}
|
||||
|
||||
int iscsi_force_reconnect_sync(struct iscsi_context *iscsi)
|
||||
{
|
||||
struct iscsi_sync_state state;
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (iscsi_force_reconnect(iscsi) != 0) {
|
||||
iscsi_set_error(iscsi, "Failed to reconnect. %s", iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
|
||||
reconnect_event_loop(iscsi, &state);
|
||||
|
||||
return (state.status == SCSI_STATUS_GOOD) ? 0 : -1;
|
||||
}
|
||||
|
||||
static void
|
||||
iscsi_task_mgmt_sync_cb(struct iscsi_context *iscsi, int status,
|
||||
void *command_data, void *private_data)
|
||||
|
||||
Reference in New Issue
Block a user