[pve-devel] [PATCH v2 qemu-server 1/2] tests: mock storage locking for migration tests
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Jan 12 12:07:34 CET 2021
first, I overlooked your v2 due to lack of reply to Stefans comment there I did
not actually thought there would come one, but my followup seems mostly in line
with your patch here, so no real harm done..
On 12.01.21 09:03, Fabian Ebner wrote:
> I didn't notice yesterday, but it's actually strange that volume_is_base_and_used uses a storage lock. Its callers that plan to change volumes on the storage based on the check need to hold the lock instead. Otherwise it can happen that:
> 1. volume_is_base_and_used is called and the result is used to decide how to branch
> 2. situation on the storage changes in the meantime
> 3. the branch we are taking might not be the one we should be taking anymore
>
> vdisk_free already uses its own lock around both the __no_lock-variant of the check and the modification on the storage it does, so it's fine.
>
> The only two callers for the normal variant are in qemu-server and they both serve as preliminary checks, while the real modification for both of them happens with vdisk_free. One of the callers makes the mocking below necessary, but it wouldn't if we were to remove the storage locking from volume_is_base_and_used.
Sounds sensible without looking into it in depth yet, can you come up with a patch
to do so and look at the specifics?
More information about the pve-devel
mailing list