a3470f
From 887fff825a546712bccd78b728c8aba66d5b1504 Mon Sep 17 00:00:00 2001
a3470f
From: Pranith Kumar K <pkarampu@redhat.com>
a3470f
Date: Tue, 3 Jul 2018 20:38:23 +0530
a3470f
Subject: [PATCH 310/325] cluster/afr: Make sure lk-owner is assigned at the
a3470f
 time of lock
a3470f
a3470f
	Upstream patch: https://review.gluster.org/20455
a3470f
a3470f
Problem:
a3470f
In the new eager-lock implementation lk-owner is assigned after the
a3470f
'local' is added to the eager-lock list, so there exists a possibility
a3470f
of lock being sent even before lk-owner is assigned.
a3470f
a3470f
Fix:
a3470f
Make sure to assign lk-owner before adding local to eager-lock list
a3470f
a3470f
BUG: 1597654
a3470f
Change-Id: I26d1b7bcf3e8b22531f1dc0b952cae2d92889ef2
a3470f
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/143176
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 xlators/cluster/afr/src/afr-transaction.c | 3 +--
a3470f
 1 file changed, 1 insertion(+), 2 deletions(-)
a3470f
a3470f
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
a3470f
index ff07319..5b18f63 100644
a3470f
--- a/xlators/cluster/afr/src/afr-transaction.c
a3470f
+++ b/xlators/cluster/afr/src/afr-transaction.c
a3470f
@@ -2222,6 +2222,7 @@ __afr_eager_lock_handle (afr_local_t *local, gf_boolean_t *take_lock,
a3470f
 
a3470f
         if (local->fd && !afr_are_multiple_fds_opened (local, this)) {
a3470f
                 local->transaction.eager_lock_on = _gf_true;
a3470f
+                afr_set_lk_owner (local->transaction.frame, this, local->inode);
a3470f
         }
a3470f
 
a3470f
         lock = &local->inode_ctx->lock[local->transaction.type];
a3470f
@@ -2325,8 +2326,6 @@ lock_phase:
a3470f
         if (!local->transaction.eager_lock_on) {
a3470f
                 afr_set_lk_owner (local->transaction.frame, this,
a3470f
                                   local->transaction.frame->root);
a3470f
-        } else {
a3470f
-                afr_set_lk_owner (local->transaction.frame, this, local->inode);
a3470f
         }
a3470f
 
a3470f
 
a3470f
-- 
a3470f
1.8.3.1
a3470f