From 63fd8679fa2dad420489be2dabb41e4d6909f0e3 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 13 Apr 2015 10:06:32 +0200 Subject: [PATCH] reconnect: do not queue TESTUNIT_READY cdbs those are part of the login process to consume UNIT_ATTENTIONS. Its questionable if we should consume them at all, but iff we change that behaviour we should do it for the initial login as well as for a reconnect. Signed-off-by: Peter Lieven --- lib/connect.c | 2 +- lib/iscsi-command.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/connect.c b/lib/connect.c index 048f19c..6e19ea2 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -130,7 +130,7 @@ iscsi_login_cb(struct iscsi_context *iscsi, int status, void *command_data _U_, return; } - if (ct->lun != -1 && !iscsi->old_iscsi) { + if (ct->lun != -1) { if (iscsi_testunitready_task(iscsi, ct->lun, iscsi_testunitready_cb, ct) == NULL) { iscsi_set_error(iscsi, "iscsi_testunitready_async failed."); diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c index 493e288..66f442b 100644 --- a/lib/iscsi-command.c +++ b/lib/iscsi-command.c @@ -206,7 +206,8 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun, struct iscsi_pdu *pdu; int flags; - if (iscsi->old_iscsi) { + if (iscsi->old_iscsi && + (iscsi->is_loggedin == 0 || task->cdb[0] != SCSI_OPCODE_TESTUNITREADY)) { iscsi = iscsi->old_iscsi; ISCSI_LOG(iscsi, 2, "iscsi_scsi_command_async: queuing cmd to old_iscsi while reconnecting"); }