From da1123b9d87db1642883336e990ff393ae0fcc50 Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Mon, 28 Jun 2010 14:10:36 +0000 Subject: cluster/afr: Set lk-owner to pid when fuse does not supply it. Use the frame->root address as lk-owner when FUSE does not supply lk_owner. Raghu, I unit tested this patch with dbench and self heal tests. Did not observe lk-owner=0 in any server logs. Can you verify this patch with the other tests you had run today? Signed-off-by: Pavan Vilas Sondur Signed-off-by: Anand V. Avati BUG: 1032 (Set lock-owner with pid when fuse does not supply value) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1032 --- xlators/cluster/afr/src/afr-self-heal-common.c | 2 ++ xlators/cluster/afr/src/afr-transaction.c | 2 ++ xlators/cluster/afr/src/afr.c | 11 +++++++++++ xlators/cluster/afr/src/afr.h | 3 +++ 4 files changed, 18 insertions(+) diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index d22bea68c78..967173146fd 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -1536,6 +1536,8 @@ afr_self_heal (call_frame_t *frame, xlator_t *this) local = frame->local; priv = this->private; + afr_set_lk_owner (frame, this); + if (local->self_heal.background) { LOCK (&priv->lock); { diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index 2d689e389bc..75a059f303c 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -1373,9 +1373,11 @@ int afr_lock_rec (call_frame_t *frame, xlator_t *this, int child_index) int32_t afr_lock (call_frame_t *frame, xlator_t *this) { + afr_pid_save (frame); frame->root->pid = (long) frame->root; + afr_set_lk_owner (frame, this); return afr_lock_rec (frame, this, 0); } diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index 6afb2fb97db..10f572925fa 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -60,6 +60,17 @@ #define AFR_ICTX_READ_CHILD_MASK 0x00000000FFFFFFFFULL +void +afr_set_lk_owner (call_frame_t *frame, xlator_t *this) +{ + if (!frame->root->lk_owner) { + gf_log (this->name, GF_LOG_TRACE, + "Setting lk-owner=%llu", + (unsigned long long) frame->root); + frame->root->lk_owner = (uint64_t) frame->root; + } +} + uint64_t afr_is_split_brain (xlator_t *this, inode_t *inode) { diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 2d847622e27..c4262cfb7a0 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -579,6 +579,9 @@ typedef struct { /* have we tried all children? */ #define all_tried(i, count) ((i) == (count) - 1) +void +afr_set_lk_owner (call_frame_t *frame, xlator_t *this); + int afr_fd_ctx_set (xlator_t *this, fd_t *fd); -- cgit