qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	"Bin Guo" <guobin@linux.alibaba.com>,
	qemu-devel@nongnu.org, farosas@suse.de
Subject: Re: [PATCH] migration: Don't free the reason after calling migrate_add_blocker
Date: Fri, 24 Oct 2025 12:17:20 -0400	[thread overview]
Message-ID: <aPumkKBx4PoGSwNv@x1.local> (raw)
In-Reply-To: <87v7k4xuhk.fsf@pond.sub.org>

On Fri, Oct 24, 2025 at 04:08:39PM +0200, Markus Armbruster wrote:
> Markus Armbruster <armbru@redhat.com> writes:
> 
> > Daniel P. Berrangé <berrange@redhat.com> writes:
> 
> [...]
> 
> >> But wow, the migrate_add_blocker API design is unpleasant with its
> >> pair of "Error **" parameters - it is practically designed to
> >> maximise confusion & surprise.
> >
> > It's quite a sight, isn't it?
> >
> > I'll give it a quick Friday afternoon try.
> 
> Alright, my confusion has been maximised.  Giving up on this.

Besides the use of two Error** that might be confusing, what is more
confusing (if not wrong..): migrate_add_blocker() will take ownership of
the 1st Error**, no matter whether the helper succeeded or not. However, it
only resets the first Error** if failed.

I think it means if migrate_add_blocker() succeeded, the caller will have a
non-NULL pointer, even if it has lost the ownership of that pointer.

I'm guessing it never caused issue only because we don't usually
error_free() the migration blocker anywhere.. but I think maybe we should
at least do an error_copy() in add_blockers()..

-- 
Peter Xu



  reply	other threads:[~2025-10-24 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  9:28 [PATCH] migration: Don't free the reason after calling migrate_add_blocker Bin Guo
2025-10-24 11:15 ` Markus Armbruster
2025-10-24 11:27   ` Daniel P. Berrangé
2025-10-24 13:41     ` Markus Armbruster
2025-10-24 14:08       ` Markus Armbruster
2025-10-24 16:17         ` Peter Xu [this message]
2025-10-24 16:31           ` Daniel P. Berrangé
2025-10-24 18:15             ` Fabiano Rosas
2025-10-27 10:25               ` Daniel P. Berrangé
2025-10-27 12:32                 ` Markus Armbruster
2025-10-27 13:54                   ` Fabiano Rosas
2025-10-24 11:53   ` Bin Guo
2025-10-24 13:40     ` Markus Armbruster

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=aPumkKBx4PoGSwNv@x1.local \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=farosas@suse.de \
    --cc=guobin@linux.alibaba.com \
    --cc=qemu-devel@nongnu.org \
    /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).