[pve-devel] [PATCH v2 qemu-server 1/2] tests: mock storage locking for migration tests
f.ebner at proxmox.com
Fri Jan 15 08:47:46 CET 2021
On 12.01.21 12:07, Thomas Lamprecht wrote:
> 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..
Sorry, in the future I'll try and send a quick response to the old
version before sending out the new one. At least if the old version is
not older than a month or so.
> 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?
Yes, will do.
More information about the pve-devel