From 887fff825a546712bccd78b728c8aba66d5b1504 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 3 Jul 2018 20:38:23 +0530 Subject: [PATCH 310/325] 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: 1597654 Change-Id: I26d1b7bcf3e8b22531f1dc0b952cae2d92889ef2 Signed-off-by: Pranith Kumar K Reviewed-on: https://code.engineering.redhat.com/gerrit/143176 Tested-by: RHGS Build Bot Reviewed-by: Sunil Kumar Heggodu Gopala Acharya --- 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 ff07319..5b18f63 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -2222,6 +2222,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]; @@ -2325,8 +2326,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