public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v2 qemu 1/2] vma: restore: call blk_unref for all opened block devices
Date: Mon, 25 Apr 2022 08:37:58 +0200	[thread overview]
Message-ID: <20220425063758.jfgrpoblou2tern2@olga.proxmox.com> (raw)
In-Reply-To: <20220421112659.74011-2-f.ebner@proxmox.com>

lgtm

While looking at the code again, I do find the error handling in
`extract_content` generally a bit lacking, though, eg. the `blk` var
moved down below is only set if `errp` is not set, but we still go ahead
with everything else, making me wonder if we shouldn't bail out then
instead...

But that's out of scope of this patch, this definitely fixes what
appears to be buggy cleanup code.

On Thu, Apr 21, 2022 at 01:26:47PM +0200, Fabian Ebner wrote:
> rather than just the last one. This is the only caller registering
> block devices with the reader, so other callers are already fine.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> New in v2.
> 
> Best squashed into 0026-PVE-Backup-add-vma-backup-format-code.patch
> 
>  vma-reader.c | 3 +++
>  vma.c        | 6 ++----
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/vma-reader.c b/vma-reader.c
> index 2b1d1cdab3..4f4ee2b47b 100644
> --- a/vma-reader.c
> +++ b/vma-reader.c
> @@ -192,6 +192,9 @@ void vma_reader_destroy(VmaReader *vmar)
>          if (vmar->rstate[i].bitmap) {
>              g_free(vmar->rstate[i].bitmap);
>          }
> +        if (vmar->rstate[i].target) {
> +            blk_unref(vmar->rstate[i].target);
> +        }
>      }
>  
>      if (vmar->md5csum) {
> diff --git a/vma.c b/vma.c
> index df542b7732..89440733b1 100644
> --- a/vma.c
> +++ b/vma.c
> @@ -309,8 +309,6 @@ static int extract_content(int argc, char **argv)
>      int vmstate_fd = -1;
>      guint8 vmstate_stream = 0;
>  
> -    BlockBackend *blk = NULL;
> -
>      for (i = 1; i < 255; i++) {
>          VmaDeviceInfo *di = vma_reader_get_device_info(vmar, i);
>          if (di && (strcmp(di->devname, "vmstate") == 0)) {
> @@ -331,6 +329,8 @@ static int extract_content(int argc, char **argv)
>              int flags = BDRV_O_RDWR;
>              bool write_zero = true;
>  
> +            BlockBackend *blk = NULL;
> +
>              if (readmap) {
>                  RestoreMap *map;
>                  map = (RestoreMap *)g_hash_table_lookup(devmap, di->devname);
> @@ -443,8 +443,6 @@ static int extract_content(int argc, char **argv)
>  
>      vma_reader_destroy(vmar);
>  
> -    blk_unref(blk);
> -
>      bdrv_close_all();
>  
>      return ret;
> -- 
> 2.30.2




  reply	other threads:[~2022-04-25  6:37 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 11:26 [pve-devel] [PATCH-SERIES v2 qemu/qemu-server/widget-toolkit/manager] more flexible restore Fabian Ebner
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu 1/2] vma: restore: call blk_unref for all opened block devices Fabian Ebner
2022-04-25  6:37   ` Wolfgang Bumiller [this message]
2022-04-25 16:10   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu 2/2] vma: allow partial restore Fabian Ebner
2022-04-25  6:40   ` Wolfgang Bumiller
2022-04-25 16:10   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 1/7] restore: cleanup oldconf: also clean up snapshots from kept volumes Fabian Ebner
2022-04-25 16:20   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 2/7] restore destroy volumes: remove check for absolute path Fabian Ebner
2022-04-25 16:20   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 3/7] restore deactivate volumes: never die Fabian Ebner
2022-04-23  9:18   ` Thomas Lamprecht
2022-04-25  6:45     ` Fabian Ebner
2022-04-25 16:21   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 4/7] restore: also deactivate/destroy cloud-init disk upon error Fabian Ebner
2022-04-25 16:21   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 5/7] api: create: refactor parameter check logic Fabian Ebner
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 6/7] api: create: allow overriding non-disk options during restore Fabian Ebner
2022-04-21 11:26 ` [pve-devel] [PATCH v2 qemu-server 7/7] restore: allow preserving drives " Fabian Ebner
2022-04-21 11:26 ` [pve-devel] [PATCH v2 widget-toolkit 1/1] css: add proxmox-good-row class Fabian Ebner
2022-04-23  8:32   ` [pve-devel] applied: " Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 manager 1/3] ui: restore: disallow empty storage selection if it wouldn't work Fabian Ebner
2022-04-23  9:38   ` Thomas Lamprecht
2022-04-25  7:28     ` Fabian Ebner
2022-04-27  7:05       ` Thomas Lamprecht
2022-04-27  8:21         ` Fabian Ebner
2022-04-21 11:26 ` [pve-devel] [PATCH v2 manager 2/3] ui: restore: allow override of some settings Fabian Ebner
2022-04-23 10:07   ` Thomas Lamprecht
2022-04-21 11:26 ` [pve-devel] [PATCH v2 manager 3/3] ui: restore: allow preserving disks Fabian Ebner

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=20220425063758.jfgrpoblou2tern2@olga.proxmox.com \
    --to=w.bumiller@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal