Blob Blame History Raw
From 5dcb9acb287ad740ae80081211f5e92249beed75 Mon Sep 17 00:00:00 2001
From: Pranith Kumar K <pkarampu@redhat.com>
Date: Tue, 3 Jul 2018 20:38:23 +0530
Subject: [PATCH 682/685] cluster/afr: Make sure lk-owner is assigned at the
 time of lock

	Upstream patch: https://review.gluster.org/20455

Problem:
In the new eager-lock implementation lk-owner is assigned after the
'local' is added to the eager-lock list, so there exists a possibility
of lock being sent even before lk-owner is assigned.

Fix:
Make sure to assign lk-owner before adding local to eager-lock list

BUG: 1597648
Change-Id: I26d1b7bcf3e8b22531f1dc0b952cae2d92889ef2
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/143174
Reviewed-by: Ravishankar Narayanankutty <ravishankar@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Tested-by: RHGS Build Bot <nigelb@redhat.com>
---
 xlators/cluster/afr/src/afr-transaction.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index d19795d..750e3f8 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -2168,6 +2168,7 @@ __afr_eager_lock_handle (afr_local_t *local, gf_boolean_t *take_lock,
 
         if (local->fd && !afr_are_multiple_fds_opened (local, this)) {
                 local->transaction.eager_lock_on = _gf_true;
+                afr_set_lk_owner (local->transaction.frame, this, local->inode);
         }
 
         lock = &local->inode_ctx->lock[local->transaction.type];
@@ -2271,8 +2272,6 @@ lock_phase:
         if (!local->transaction.eager_lock_on) {
                 afr_set_lk_owner (local->transaction.frame, this,
                                   local->transaction.frame->root);
-        } else {
-                afr_set_lk_owner (local->transaction.frame, this, local->inode);
         }
 
 
-- 
1.8.3.1