qemu: snapshot: Fix image lock handling when taking a snapshot
qemu: snapshot: Fix image lock handling when taking a snapshot

When we take a snapshot we must properly remove our locking
infrastructure locks. This was broken by commit 3817fa10c4ad9 which
attempted to properly track the readonly state for the image as the
locking code was executed after this change. Since we forced the image
which was locked as read-write to read-only prior to unlocking it the
write lock was not dropped.

Fix it by moving the locking code prior to modifying the readonly flag.

https://bugzilla.redhat.com/show_bug.cgi?id=1745618

Signed-off-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>

libvirt/libvirt,crobinso/libvirt,zippy2/libvirt,jfehlig/libvirt,jfehlig/libvirt,zippy2/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,andreabolognani/libvirt,jardasgit/libvirt,libvirt/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,crobinso/libvirt,fabianfreyer/libvirt,jardasgit/libvirt,olafhering/libvirt,andreabolognani/libvirt,libvirt/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,andreabolognani/libvirt,fabianfreyer/libvirt,olafhering/libvirt,jfehlig/libvirt,nertpinx/libvirt,crobinso/libvirt,zippy2/libvirt,jardasgit/libvirt,jardasgit/libvirt,olafhering/libvirt,jfehlig/libvirt,nertpinx/libvirt,olafhering/libvirt,andreabolognani/libvirt,zippy2/libvirt,libvirt/libvirt,andreabolognani/libvirt,crobinso/libvirt,nertpinx/libvirt