[PATCH] util: make use of VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE in virLockSpaceAcquireResource

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When create external disk snapshot with virtlock enabled, libvirtd
will hang if flag VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE is missed in
virLockSpaceAcquireResource.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1191901
Signed-off-by: Shanzhi Yu <shyu@xxxxxxxxxx>
---
 src/util/virlockspace.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 2366a74..25b4433 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -626,8 +626,10 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspace,
     virMutexLock(&lockspace->lock);
 
     if ((res = virHashLookup(lockspace->resources, resname))) {
-        if ((res->flags & VIR_LOCK_SPACE_ACQUIRE_SHARED) &&
-            (flags & VIR_LOCK_SPACE_ACQUIRE_SHARED)) {
+        if (((res->flags & VIR_LOCK_SPACE_ACQUIRE_SHARED) &&
+            (flags & VIR_LOCK_SPACE_ACQUIRE_SHARED)) ||
+            ((res->flags & VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE) &&
+            (flags & VIR_LOCK_SPACE_ACQUIRE_AUTOCREATE))){
 
             if (VIR_EXPAND_N(res->owners, res->nOwners, 1) < 0)
                 goto cleanup;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]