Virtuozzo QEMU development (svt-core@virtuozzo.com)
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: andrey.drobyshev@virtuozzo.com
Cc: svt-core@virtuozzo.com, den@openvz.org
Subject: [PATCH hci-8.1 0/5] scsi-disk: fix UNMAP and WRITE SAME racing with inactivation #VSTOR-151532
Date: Mon, 26 Oct 2026 18:49:24 +0100	[thread overview]
Message-ID: <20261026174929.685720-1-den@openvz.org> (raw)

scsi-disk splits UNMAP into one discard per descriptor and a non-zero
WRITE SAME into 512 KiB writes, submitting each step from the
completion callback of the previous one. A drain in between only waits
for the step in flight; the next one is queued by
blk_wait_while_drained() and resumed by drain_end. When the drain is
the one in bdrv_inactivate_all() (end of live migration,
blockdev-set-active), the resumed request hits an inactive node:

  bdrv_co_write_req_prepare: Assertion
  `!(bs->open_flags & BDRV_O_INACTIVE)' failed.

We hit this in production on a guest UNMAP with 38 descriptors.

The fix follows the one Kevin did for IDE TRIM:
https://lore.kernel.org/qemu-devel/20260421161132.99878-1-kwolf@redhat.com/

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Hanna Reitz <hreitz@redhat.com>
Cc: Fabiano Rosas <farosas@suse.de>
Cc: Laurent Vivier <lvivier@redhat.com>
Cc: qemu-stable@nongnu.org

Denis V. Lunev (5):
  scsi-disk: check all UNMAP descriptors before discarding any
    #VSTOR-151532
  scsi-disk: fix UNMAP racing with inactivation of block nodes
    #VSTOR-151532
  scsi-disk: fix WRITE SAME racing with inactivation of block nodes
    #VSTOR-151532
  virtio-scsi-test: split virtio_scsi_do_command() into submit and wait
    #VSTOR-151532
  virtio-scsi-test: test UNMAP and WRITE SAME during inactivation
    #VSTOR-151532

 hw/scsi/scsi-disk.c            | 278 +++++++++++++++++++--------------
 tests/qtest/virtio-scsi-test.c | 173 +++++++++++++++++---
 2 files changed, 309 insertions(+), 142 deletions(-)

base-commit: 81aea91c7f71cba39b4c3340579d45f0256a91d8

-- 
2.53.0


             reply	other threads:[~2026-10-26 17:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 17:49 Denis V. Lunev [this message]
2026-10-26 17:49 ` [PATCH hci-8.1 1/5] scsi-disk: check all UNMAP descriptors before discarding any #VSTOR-151532 Denis V. Lunev
2026-10-26 17:49 ` [PATCH hci-8.1 2/5] scsi-disk: fix UNMAP racing with inactivation of block nodes #VSTOR-151532 Denis V. Lunev
2026-10-26 17:49 ` [PATCH hci-8.1 3/5] scsi-disk: fix WRITE SAME " Denis V. Lunev
2026-10-26 17:49 ` [PATCH hci-8.1 4/5] virtio-scsi-test: split virtio_scsi_do_command() into submit and wait #VSTOR-151532 Denis V. Lunev
2026-10-26 17:49 ` [PATCH hci-8.1 5/5] virtio-scsi-test: test UNMAP and WRITE SAME during inactivation #VSTOR-151532 Denis V. Lunev
2026-10-27 10:56 ` [PATCH hci-8.1 0/5] scsi-disk: fix UNMAP and WRITE SAME racing with " Andrey Drobyshev

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=20261026174929.685720-1-den@openvz.org \
    --to=den@openvz.org \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox