From efcf6024765b2ac2027152e50c5c252aea1ea978 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 4 May 2015 16:41:40 +0200 Subject: [PATCH] nop: print a warning if the oldest element in iscsi->waitpdu queue is stuck Signed-off-by: Peter Lieven --- include/iscsi-private.h | 1 + lib/login.c | 2 +- lib/nop.c | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index d1d8d5e..f5efd84 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -87,6 +87,7 @@ struct iscsi_context { unsigned char isid[6]; uint32_t itt; uint32_t cmdsn; + uint32_t min_cmdsn_waiting; uint32_t expcmdsn; uint32_t maxcmdsn; uint32_t statsn; diff --git a/lib/login.c b/lib/login.c index 9b813d7..81d1d2b 100644 --- a/lib/login.c +++ b/lib/login.c @@ -794,7 +794,7 @@ iscsi_login_async(struct iscsi_context *iscsi, iscsi_command_cb cb, if (!iscsi->current_phase && !iscsi->secneg_phase) { iscsi->itt = (u_int32_t) rand(); iscsi->cmdsn = (u_int32_t) rand(); - iscsi->expcmdsn = iscsi->maxcmdsn = iscsi->cmdsn; + iscsi->expcmdsn = iscsi->maxcmdsn = iscsi->min_cmdsn_waiting = iscsi->cmdsn; } pdu = iscsi_allocate_pdu(iscsi, diff --git a/lib/nop.c b/lib/nop.c index 548e73e..f828822 100644 --- a/lib/nop.c +++ b/lib/nop.c @@ -143,6 +143,12 @@ iscsi_process_nop_out_reply(struct iscsi_context *iscsi, struct iscsi_pdu *pdu, "NOP-In received (pdu->itt %08x, pdu->ttt %08x, iscsi->maxcmdsn %08x, iscsi->expcmdsn %08x, iscsi->statsn %08x)", pdu->itt, 0xffffffff, iscsi->maxcmdsn, iscsi->expcmdsn, iscsi->statsn); + 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); + } + iscsi->min_cmdsn_waiting = iscsi->waitpdu->cmdsn; + iscsi->nops_in_flight = 0; if (pdu->callback == NULL) {