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