qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: stefanb@linux.vnet.ibm.com, farosas@suse.de,
	qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [PATCH] migration: vmsd errp handlers: return bool
Date: Mon, 20 Oct 2025 09:49:04 -0400	[thread overview]
Message-ID: <aPY90JnJtyHZUUuq@x1.local> (raw)
In-Reply-To: <20251020091907.2173711-1-vsementsov@yandex-team.ru>

On Mon, Oct 20, 2025 at 12:19:07PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> @@ -255,13 +252,12 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>          qemu_file_set_error(f, ret);
>          return ret;
>      }
> -    if (vmsd->post_load_errp) {
> -        ret = vmsd->post_load_errp(opaque, version_id, errp);
> -        if (ret < 0) {
> -            error_prepend(errp, "post load hook failed for: %s, version_id: "
> -                          "%d, minimum_version: %d, ret: %d: ", vmsd->name,
> -                          vmsd->version_id, vmsd->minimum_version_id, ret);
> -        }
> +    if (vmsd->post_load_errp && !vmsd->post_load_errp(opaque, version_id,

I think this will change the semantics even if I do not expect a real user
to exist.. if post_load_errp() returned true here, then it'll keep looking
for post_load() and execute.

It might still be good to keep the old semantics, so that if
post_load_errp() is provided, then we ignore post_load().  Same to the rest
hooks.

> +                                                      errp)) {
> +        error_prepend(errp, "post load hook failed for: %s, version_id: "
> +                      "%d, minimum_version: %d, ret: %d: ", vmsd->name,
> +                      vmsd->version_id, vmsd->minimum_version_id, ret);
> +        ret = -EINVAL;
>      } else if (vmsd->post_load) {
>          ret = vmsd->post_load(opaque, version_id);
>          if (ret < 0) {
> @@ -438,9 +434,8 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDescription *vmsd,
>      trace_vmstate_save_state_top(vmsd->name);
>  
>      if (vmsd->pre_save_errp) {
> -        ret = vmsd->pre_save_errp(opaque, errp);
>          trace_vmstate_save_state_pre_save_res(vmsd->name, ret);
> -        if (ret < 0) {
> +        if (!vmsd->pre_save_errp(opaque, errp)) {
>              error_prepend(errp, "pre-save for %s failed, ret: %d: ",
>                            vmsd->name, ret);
>          }
> -- 
> 2.48.1
> 

-- 
Peter Xu



  parent reply	other threads:[~2025-10-20 13:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20  9:19 [PATCH] migration: vmsd errp handlers: return bool Vladimir Sementsov-Ogievskiy
2025-10-20 11:05 ` Markus Armbruster
2025-10-20 11:22   ` Vladimir Sementsov-Ogievskiy
2025-10-20 11:40     ` Daniel P. Berrangé
2025-10-20 14:34       ` Markus Armbruster
2025-10-20 15:05         ` Vladimir Sementsov-Ogievskiy
2025-10-20 16:40           ` Markus Armbruster
2025-10-20 18:43             ` Vladimir Sementsov-Ogievskiy
2025-10-21 11:36               ` Markus Armbruster
2025-10-21 11:48                 ` Vladimir Sementsov-Ogievskiy
2025-10-20 15:10     ` Vladimir Sementsov-Ogievskiy
2025-10-20 13:49 ` Peter Xu [this message]
2025-10-20 15:05   ` Vladimir Sementsov-Ogievskiy

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=aPY90JnJtyHZUUuq@x1.local \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=farosas@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.vnet.ibm.com \
    --cc=vsementsov@yandex-team.ru \
    /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).