add LIBISCSI_IGNORE_NOP_OUT_ON_STUCK_WAITPDU_QUEUE environment variable

this variable is a helper to tell libiscsi to not reset the nops_in_flight
on receival of a NOP-Out if the oldest element in the waitpdu queue is
not changed since the last NOP-Out.

The idea is that we can detect a command that the target silently dropped
by this mechanism and run into a NOP timeout forcing a reconnect.

This environment variable is not suitable if a command is send that is taking more than
the allowed timeout for a NOP-Out as a reply to a initiator generated NOP-In
(or several NOP-Outs if more than 1 in flight is allowed).

Signed-off-by: Peter Lieven <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-05-04 17:00:08 +02:00
parent efcf602476
commit e9d67540e1

View File

@@ -21,6 +21,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
#include "iscsi.h"
#include "iscsi-private.h"
@@ -146,11 +147,14 @@ iscsi_process_nop_out_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu,
if (iscsi->waitpdu->cmdsn == iscsi->min_cmdsn_waiting) {
ISCSI_LOG(iscsi, 2, "Oldest element in waitqueue is unchanged since last NOP-In (iscsi->min_cmdsn_waiting %08x)",
iscsi->min_cmdsn_waiting);
if (getenv("LIBISCSI_IGNORE_NOP_OUT_ON_STUCK_WAITPDU_QUEUE") == NULL) {
iscsi->nops_in_flight = 0;
}
} else {
iscsi->nops_in_flight = 0;
}
iscsi->min_cmdsn_waiting = iscsi->waitpdu->cmdsn;
iscsi->nops_in_flight = 0;
if (pdu->callback == NULL) {
return 0;
}