[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] block-backend: fix virtio-scsi assertion failure with blk_dr
From: |
Kevin Wolf |
Subject: |
Re: [PATCH] block-backend: fix virtio-scsi assertion failure with blk_drain_noref() |
Date: |
Fri, 13 Jan 2023 16:31:20 +0100 |
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