From e9d67540e16ed45ec71cd17b9745203cf52e9c98 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 4 May 2015 17:00:08 +0200 Subject: [PATCH] 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 --- lib/nop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/nop.c b/lib/nop.c index f828822..f4fec90 100644 --- a/lib/nop.c +++ b/lib/nop.c @@ -21,6 +21,7 @@ #endif #include +#include #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; }