Timeouts: Fix bugs in scsi task timeout code

Add a test to verify the pdu timeout handling.
Fix numerous bugs in the timeout handling. It was really broken.

Add test for non-SCSI task PDUs too and verify they works.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2015-05-18 21:55:26 -07:00
parent cb4ad5f774
commit 0630aa5ef0
8 changed files with 332 additions and 47 deletions

View File

@@ -53,6 +53,8 @@ event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state)
int ret;
while (state->finished == 0) {
short revents;
pfd.fd = iscsi_get_fd(iscsi);
pfd.events = iscsi_which_events(iscsi);
@@ -61,11 +63,8 @@ event_loop(struct iscsi_context *iscsi, struct iscsi_sync_state *state)
state->status = -1;
return;
}
if (ret == 0) {
iscsi_timeout_scan(iscsi);
continue;
}
if (iscsi_service(iscsi, pfd.revents) < 0) {
revents = (ret == 0) ? 0 : pfd.revents;
if (iscsi_service(iscsi, revents) < 0) {
iscsi_set_error(iscsi,
"iscsi_service failed with : %s",
iscsi_get_error(iscsi));