From: Konstantin Nigmatullin <rangolit@gmail.com>
To: qemu-devel@nongnu.org
Cc: Konstantin Nigmatullin <rangolit@gmail.com>,
qemu-block@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Peter Lieven <pl@kamp.de>, Kevin Wolf <kwolf@redhat.com>,
Hanna Reitz <hreitz@redhat.com>
Subject: [PATCH 5/5] iscsi: avoid null iSCSI error strings after cancel or timeout
Date: Wed, 22 Jul 2026 03:02:54 +0200 [thread overview]
Message-ID: <20260722010254.424820-6-rangolit@gmail.com> (raw)
In-Reply-To: <20260722010254.424820-1-rangolit@gmail.com>
Cancelled and timed-out tasks often left err_str unset, so logs printed
"(null)" instead of a useful reason.
See: https://gitlab.com/qemu-project/qemu/-/work_items/3067
Signed-off-by: Konstantin Nigmatullin <rangolit@gmail.com>
---
block/iscsi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c
index b6207d03e5..0ab12987b8 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -290,6 +290,20 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int status,
iscsilun->nop_failures = 0;
}
+ if (status != SCSI_STATUS_GOOD && !iTask->do_retry && !iTask->err_str) {
+ const char *e = iscsi_get_error(iscsi);
+
+ if (e && e[0]) {
+ iTask->err_str = g_strdup(e);
+ } else if (status == SCSI_STATUS_CANCELLED) {
+ iTask->err_str = g_strdup("task cancelled");
+ } else if (status == SCSI_STATUS_TIMEOUT) {
+ iTask->err_str = g_strdup("command timed out");
+ } else {
+ iTask->err_str = g_strdup("I/O error");
+ }
+ }
+
/*
* aio_co_wake() is safe to call: iscsi_service(), which called us, is only
* run from the event_timer and/or the FD handlers, never from the request
--
2.53.0
prev parent reply other threads:[~2026-07-22 11:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 1:02 [PATCH 0/5] iscsi: fix hang after abrupt target disconnect Konstantin Nigmatullin
2026-07-22 1:02 ` [PATCH 1/5] iscsi: detect dead iSCSI sessions via local NOP failure counting Konstantin Nigmatullin
2026-07-22 1:02 ` [PATCH 2/5] iscsi: stop retrying timed-out iSCSI commands Konstantin Nigmatullin
2026-07-22 1:02 ` [PATCH 3/5] iscsi: cancel in-flight iSCSI tasks when the session dies Konstantin Nigmatullin
2026-07-22 1:02 ` [PATCH 4/5] iscsi: fail new iSCSI I/O while the transport is known down Konstantin Nigmatullin
2026-07-22 1:02 ` Konstantin Nigmatullin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722010254.424820-6-rangolit@gmail.com \
--to=rangolit@gmail.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.