Shireesh Anjal has uploaded a new change for review.

Change subject: gluster: release lock in canDoActionOnly()
......................................................................

gluster: release lock in canDoActionOnly()

Gluster commands always acquire a lock on the cluster. This means that
if user selects multiple objects belonging to the same cluster and
performs an action on them, all of them try to acquire a lock on the
same cluster. The logic in MultipleActionsRunner is such that
canDoActionOnly() is called for all actions first, before trying to
execute them. This can result in a deadlock as the second action will
get blocked trying to acquire lock on the same cluster, and
executeAction() will never be invoked on first action because of this.
This is seems like a gluster-specific scenario for now, and hence we're
overriding canDoActionOnly() to release the lock in the end. This
allows all calls to canDoActionOnly() to proceed, and executeAction()
will acquire the lock again anyway.

Change-Id: I738990694c8a27ff64435194756119339e255f47
Signed-off-by: Shireesh Anjal <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/57/10757/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java
index ca705dc..799414d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GlusterCommandBase.java
@@ -34,6 +34,24 @@
         super(params);
     }
 
+    /**
+     * Gluster commands always acquire a lock on the cluster. This means that 
if user selects multiple objects belonging
+     * to the same cluster and performs an action on them, all of them try to 
acquire a lock on the same cluster. The
+     * logic in MultipleActionsRunner is such that canDoActionOnly() is called 
for all actions first, before trying to
+     * execute them. This can result in a deadlock as the second action will 
get blocked trying to acquire lock on the
+     * same cluster, and executeAction() will never be invoked on first action 
because of this. This is seems like a
+     * gluster-specific scenario for now, and hence we're overriding 
canDoActionOnly() to release the lock in the end.
+     * This allows all calls to canDoActionOnly() to proceed, and 
executeAction() will acquire the lock again anyway.
+     */
+    @Override
+    public VdcReturnValueBase canDoActionOnly() {
+        try {
+            return super.canDoActionOnly();
+        } finally {
+            freeLock();
+        }
+    }
+
     @Override
     protected Map<String, String> getExclusiveLocks() {
         if (!isInternalExecution()) {


--
To view, visit http://gerrit.ovirt.org/10757
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I738990694c8a27ff64435194756119339e255f47
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Shireesh Anjal <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to