public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Fabian Ebner <f.ebner@proxmox.com>
Subject: [pve-devel] applied: [PATCH storage] remove lock from is_base_and_used check
Date: Sat, 6 Feb 2021 14:48:38 +0100	[thread overview]
Message-ID: <8adf8d91-6992-3c1c-baf6-435c0eb15a2f@proxmox.com> (raw)
In-Reply-To: <20210115105805.19994-1-f.ebner@proxmox.com>

On 15.01.21 11:58, Fabian Ebner wrote:
> and squash the __no_lock-variant into it.
> 
> This lock is not broad enough, because for a caller that plans to do or not do
> some storage operation based on the result of the check, the following could
> happen:
> 1. volume_is_base_and_used is called and the result is used to enter a branch
> 2. situation on the storage changes in the meantime
> 3. the branch chosen in 1. might not be the one that should be taken anymore
> 
> This means that callers are responsible for locking, and luckily the existing
> callers do use their own locks already:
> 1. vdisk_free used the __no_lock-variant with a broader lock also covering
>    the free operation.
> 2. vdisk_clone is not a caller, but is relevant and it does lock the storage
> 2. the calls during VM migration and VM destruction happen in the context of a
>    locked VM config. Because the clone operation also locks the VM config, it
>    cannot happen that a linked clone is created while the template VM is
>    migrated away or destroyed or vice versa. And even if that were the case,
>    the base disk would not be freed, because of what vdisk_free/vdisk_clone do.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  PVE/Storage.pm | 28 ++++++++++------------------
>  1 file changed, 10 insertions(+), 18 deletions(-)
> 
>

applied, thanks!




      reply	other threads:[~2021-02-06 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 10:58 [pve-devel] " Fabian Ebner
2021-02-06 13:48 ` Thomas Lamprecht [this message]

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=8adf8d91-6992-3c1c-baf6-435c0eb15a2f@proxmox.com \
    --to=t.lamprecht@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