All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fiona Ebner <f.ebner@proxmox.com>, Kevin Wolf <kwolf@redhat.com>,
	Hanna Reitz <hreitz@redhat.com>,
	qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org,
	eduardo@habkost.net, pbonzini@redhat.com,
	vsementsov@virtuozzo.com
Subject: Re: [PATCH v2] hw/core/qdev-properties-system: Add missing return in set_drive_helper()
Date: Fri, 30 May 2025 16:36:03 +0100	[thread overview]
Message-ID: <aDnQYxtZH_SSxbcX@redhat.com> (raw)
In-Reply-To: <20250523070211.280498-1-f.ebner@proxmox.com>

Copying block maintainers, since while this is in QOM source files, this 
method is defacto block layer code.

On Fri, May 23, 2025 at 09:02:11AM +0200, Fiona Ebner wrote:
> Currently, changing the 'drive' property of e.g. a scsi-hd object will
> result in an assertion failure if the aio context of the block node
> it's replaced with doesn't match the current aio context:
> 
> > bdrv_replace_child_noperm: Assertion `bdrv_get_aio_context(old_bs) ==
> > bdrv_get_aio_context(new_bs)' failed.
> 
> The problematic scenario is already detected, but a 'return' statement
> was missing.
> 
> Cc: qemu-stable@nongnu.org
> Fixes: d1a58c176a ("qdev: allow setting drive property for realized device")
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> Changes in v2:
> * Add missing condition in commit message, sorry for the noise!
> 
> Reproducer:
> 
> #!/bin/bash
> rm /tmp/disk0.raw
> rm /tmp/disk1.raw
> ./qemu-img create -f raw /tmp/disk0.raw 1G
> ./qemu-img create -f raw /tmp/disk1.raw 1G
> ./qemu-system-x86_64 --qmp stdio \
> --blockdev file,node-name=node0,filename=/tmp/disk0.raw \
> --blockdev file,node-name=node1,filename=/tmp/disk1.raw \
> --nodefaults \
> --object 'iothread,id=iothread0' \
> --device 'virtio-scsi-pci,id=virtioscsi0,bus=pci.0,addr=0x3,iothread=iothread0' \
> --device 'scsi-hd,bus=virtioscsi0.0,scsi-id=1,drive=node0,id=scsi0' \
> <<EOF
> {"execute": "qmp_capabilities"}
> {"execute": "qom-set", "arguments": { "path": "/machine/peripheral/scsi0", "property": "drive", "value": "node1" } }
> {"execute": "quit"}
> EOF
> 
>  hw/core/qdev-properties-system.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
> index 8e11e6388b..24e145d870 100644
> --- a/hw/core/qdev-properties-system.c
> +++ b/hw/core/qdev-properties-system.c
> @@ -145,6 +145,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
>          if (ctx != bdrv_get_aio_context(bs)) {
>              error_setg(errp, "Different aio context is not supported for new "
>                         "node");
> +            return;
>          }
>  
>          blk_replace_bs(blk, bs, errp);

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-05-30 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-23  7:02 [PATCH v2] hw/core/qdev-properties-system: Add missing return in set_drive_helper() Fiona Ebner
2025-05-30 15:36 ` Daniel P. Berrangé [this message]
2025-06-04 12:57 ` Kevin Wolf

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=aDnQYxtZH_SSxbcX@redhat.com \
    --to=berrange@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=f.ebner@proxmox.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=vsementsov@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 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.