[libvirt] [PATCHv3 14/26] locking: Add APIs to lock individual image files

Eric Blake eblake at redhat.com
Thu Jun 26 03:07:14 UTC 2014


On 06/25/2014 10:54 AM, Peter Krempa wrote:
> Add helper APIs to manage individual image files rather than disks. To
> simplify the addition some parts of the code were refactored in this
> patch.
> ---
>  src/libvirt_private.syms  |  2 ++
>  src/locking/domain_lock.c | 65 ++++++++++++++++++++++++++++++-----------------
>  src/locking/domain_lock.h |  8 ++++++
>  3 files changed, 52 insertions(+), 23 deletions(-)
> 

> +static int virDomainLockManagerAddImage(virLockManagerPtr lock,
> +                                        virStorageSourcePtr src)

> 
> -    if (disk->src->readonly)
> +    if (src->readonly)
>          diskFlags |= VIR_LOCK_MANAGER_RESOURCE_READONLY;
> -    if (disk->src->shared)
> +    if (src->shared)
>          diskFlags |= VIR_LOCK_MANAGER_RESOURCE_SHARED;

Don't you also need to ensure that backing files in the chain are marked
readonly regardless of the setting on the active layer?

Oh, I see - on the lock manager, we are currently only ever locking the
active image.  Hmm, I wonder if this is actually correct in the presence
of snapshots - are we leaving a file locked when it becomes the backing
element of a new file due to an external snapshot?

We may have pre-existing bugs (while I know I got SELinux and cgroup
issues sorted out in my testing, I haven't personally played much with
the lease manager at the same time as playing with snapshots).  But as
far as I can tell, this patch makes no semantic difference, so it is no
worse than what we already had.  Therefore,

ACK

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140625/dbef61a8/attachment-0001.sig>


More information about the libvir-list mailing list