On Mon, Mar 9, 2026 at 4:15 PM Stefan Hajnoczi <[email protected]> wrote: > > On Thu, Mar 05, 2026 at 10:24:50PM +0800, Zhang Chen wrote: > > Update the usage of "iothread_get_aio_context()". > > > > Signed-off-by: Zhang Chen <[email protected]> > > --- > > blockdev.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/blockdev.c b/blockdev.c > > index 6e86c6262f..01ccf64b3f 100644 > > --- a/blockdev.c > > +++ b/blockdev.c > > @@ -3683,7 +3683,14 @@ void qmp_x_blockdev_set_iothread(const char > > *node_name, StrOrNull *iothread, > > goto out; > > } > > > > - new_context = iothread_get_aio_context(obj); > > + char *path = object_get_canonical_path(OBJECT(bs)); > > CCing Kevin and Markus in case they have an opinion on this. > > BlockDriverState is not a QOM Object so using OBJECT(bs) is undefined > behavior and may crash. > > node_name is unique across block driver graph nodes and could be used. > Unfortunately it's not connected to the QOM Object hierarchy. Maybe it's > best to build a holder name that is an invalid QOM path so there can be > no collisions between QOM paths and block driver graph nodes. > > g_autofree char *holder = g_strdup_printf("BlockDriverState %s", node_name); > > (A cleaner long-term solution would be making BlockDriverStates QOM > Objects so they have a proper path.)
If no other comments, it's OK for me. This issue like I mentioned in patch 7 and 9. > > > + /* > > + * For this qmp case, hard to find the point put aio context ??? > > + * It looks like a pairing function is needed: > > + * qmp_x_blockdev_del_iothread() > > + */ > > + new_context = iothread_get_aio_context(obj, path); > > + g_free(path); > > Who calls iothread_put_aio_context()? As the comments I wrote: > > + /* > > + * For this qmp case, hard to find the point put aio context ??? > > + * It looks like a pairing function is needed: > > + * qmp_x_blockdev_del_iothread() > > + */ Please Kevin and Markus help to see if we need to add new function 'qmp_x_blockdev_del_iothread()'? The iothread_put_aio_context() will be called in it. Thanks Chen
