All of lore.kernel.org
 help / color / mirror / Atom feed
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 0/5] iscsi: fix hang after abrupt target disconnect
Date: Wed, 22 Jul 2026 03:02:49 +0200	[thread overview]
Message-ID: <20260722010254.424820-1-rangolit@gmail.com> (raw)

When an iSCSI target disappears (for example tgtd is killed), QEMU can
leave guest I/O stuck and then fail to exit on SIGINT because
virtio_scsi_dataplane_stop blocks forever in blk_drain_all().

This is a stack of problems in block/iscsi.c, not only the documented
default command timeout of 0:

1. NOP dead-session detection never fired in practice because
   iscsi_get_nops_in_flight() stayed at 0 on a dead TCP session.
2. SCSI_STATUS_TIMEOUT was retried like BUSY (up to seven full
   timeouts), so drain stayed busy for minutes even with -iscsi
   timeout=N.
3. In-flight coroutines were not cancelled locally, so with timeout=0
   waiters never woke.
4. After one failure, queued I/O restarted another long wait, so drain
   never stayed idle (permanent hang).

This series addresses those without changing the default timeout value.

Verified with the GitLab #3067 recipe (default timeout=0). After killing
tgtd and unmounting, the guest correctly sees I/O errors, and Ctrl-C
makes QEMU exit cleanly instead of hanging in blk_drain_all:

  (initramfs) umount /mnt
  qemu-system-x86_64: terminating on signal 2
  qemu-system-x86_64: iSCSI: NOP timeout. Reconnecting...
  qemu-system-x86_64: iSCSI SYNCHRONIZECACHE10 failed: SENSE KEY:UNIT_ATTENTION(6) ASCQ:BUS_RESET(0x2900)

Residual host messages such as NOP timeout / SYNCHRONIZECACHE10
UNIT_ATTENTION(BUS_RESET) are expected while in-flight flush fails on a
dead session during reconnect; they are cosmetic and not a correctness
issue for this series.

Buglink: https://gitlab.com/qemu-project/qemu/-/issues/3067

Konstantin Nigmatullin (5):
  iscsi: detect dead iSCSI sessions via local NOP failure counting
  iscsi: stop retrying timed-out iSCSI commands
  iscsi: cancel in-flight iSCSI tasks when the session dies
  iscsi: fail new iSCSI I/O while the transport is known down
  iscsi: avoid null iSCSI error strings after cancel or timeout

 block/iscsi.c | 124 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 113 insertions(+), 11 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-07-22 11:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  1:02 Konstantin Nigmatullin [this message]
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 ` [PATCH 5/5] iscsi: avoid null iSCSI error strings after cancel or timeout Konstantin Nigmatullin

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-1-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.