Add support for synchronous command timeout.

Default to 0 meaning no timeout.

Implement a test for iSCS to test what happens if we send a command
with CMDSN being higher than the target allows.
In this case we dont strictly know what will happen, just that what should
NOT happen is the target responding with success.
But we have to be prepared for any kind of failure, including a timeout,
scsi sense, or even iscsi reject or session failure.
This commit is contained in:
Ronnie Sahlberg
2013-04-29 20:42:33 -07:00
parent 5bce69f1f3
commit 4a8d967541
13 changed files with 324 additions and 169 deletions

View File

@@ -70,11 +70,18 @@ EXTERN int iscsi_service(struct iscsi_context *iscsi, int revents);
*/
EXTERN int iscsi_queue_length(struct iscsi_context *iscsi);
/*
* Set the timeout in seconds after which a synchronous SCSI command
* will timeout.
* Default is 0 == no timeout.
*/
EXTERN int iscsi_set_timeout(struct iscsi_context *iscsi, int timeout);
/*
* To set tcp keepalive for the session.
* Only options supported by given platform (if any) are set.
*/
int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval);
EXTERN int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval);
struct iscsi_url {
char portal[MAX_STRING_SIZE+1];
@@ -268,7 +275,8 @@ enum scsi_status {
SCSI_STATUS_RESERVATION_CONFLICT = 0x18,
SCSI_STATUS_REDIRECT = 0x101,
SCSI_STATUS_CANCELLED = 0x0f000000,
SCSI_STATUS_ERROR = 0x0f000001
SCSI_STATUS_ERROR = 0x0f000001,
SCSI_STATUS_TIMEOUT = 0x0f000002
};