qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Hanna Reitz <hreitz@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <fam@euphon.net>,
	Qing Wang <qinwang@redhat.com>,
	Emanuele Giuseppe Esposito <eesposit@redhat.com>
Subject: Re: [PATCH] block-backend: fix virtio-scsi assertion failure with blk_drain_noref()
Date: Fri, 13 Jan 2023 16:31:20 +0100	[thread overview]
Message-ID: <Y8F5SACiNCjoNXR/@redhat.com> (raw)
In-Reply-To: <20230104195633.86143-1-stefanha@redhat.com>

Am 04.01.2023 um 20:56 hat Stefan Hajnoczi geschrieben:
> scsi_device_purge_requests() is called from I/O code by virtio-scsi TMF
> emulation code. It must not call Global State APIs like blk_drain()
> because that results in an assertion failure.
> 
> blk_drain() is a Global State API because it uses bdrv_unref(). Actually
> ref/unref is unnecessary in device emulation code because the drive=
> qdev property holds the reference.

Just for the record: We came to the conclusion that this isn't true.

We're not doing blk_ref/unref here, but bdrv_ref/unref. The function
calls bdrv_drained_end(bs), so the node must still exist at that point
and the ref/unref is required to ensure this.

The root node of the BlockBackend can change, so without the ref/unref
pair the last reference to the node can go away even if the BlockBackend
still exists.

So we'll need a different solution.

Kevin



      parent reply	other threads:[~2023-01-13 15:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 19:56 [PATCH] block-backend: fix virtio-scsi assertion failure with blk_drain_noref() Stefan Hajnoczi
2023-01-04 21:37 ` Paolo Bonzini
2023-01-05 11:34   ` Stefan Hajnoczi
2023-01-05 11:59     ` Paolo Bonzini
2023-01-13 15:31 ` Kevin Wolf [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=Y8F5SACiNCjoNXR/@redhat.com \
    --to=kwolf@redhat.com \
    --cc=eesposit@redhat.com \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qinwang@redhat.com \
    --cc=stefanha@redhat.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;
as well as URLs for NNTP newsgroup(s).