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:
@@ -61,6 +61,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include "scsi-lowlevel.h"
|
||||
#include "iscsi.h"
|
||||
#include "iscsi-private.h"
|
||||
@@ -73,7 +74,13 @@ iscsi_add_to_outqueue(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||
{
|
||||
struct iscsi_pdu *current = iscsi->outqueue;
|
||||
struct iscsi_pdu *last = NULL;
|
||||
|
||||
|
||||
if (iscsi->scsi_timeout > 0) {
|
||||
pdu->scsi_timeout = time(NULL) + iscsi->scsi_timeout;
|
||||
} else {
|
||||
pdu->scsi_timeout = 0;
|
||||
}
|
||||
|
||||
if (iscsi->outqueue == NULL) {
|
||||
iscsi->outqueue = pdu;
|
||||
pdu->next = NULL;
|
||||
|
||||
Reference in New Issue
Block a user