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