From 36b102645ab66d141dcc831e67caa78966d45419 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 30 Jul 2013 18:29:15 +0530 Subject: cluster/afr: Disable eager-lock if open-fd-count > 1 Lets say mount1 has eager-lock(full-lock) and after the eager-lock is taken mount2 opened the same file, it won't be able to perform any data operations until mount1 releases eager-lock. To avoid such scenario do not enable eager-lock for transaction if open-fd-count is > 1. Delaying of changelog piggybacking is avoided in this situation. Change-Id: I51b45d6a7c216a78860aff0265a0b8dabc6423a5 BUG: 910217 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/5432 Tested-by: Gluster Build System Reviewed-by: venkatesh somyajulu Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-common.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'xlators/cluster/afr/src/afr-common.c') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 075f33c618b..79644b74086 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -4890,3 +4890,28 @@ afr_is_fd_fixable (fd_t *fd) return _gf_true; } + +void +afr_handle_open_fd_count (call_frame_t *frame, xlator_t *this) +{ + afr_local_t *local = NULL; + inode_t *inode = NULL; + afr_inode_ctx_t *ctx = NULL; + + local = frame->local; + + if (local->fd) + inode = local->fd->inode; + else + inode = local->loc.inode; + + if (!inode) + return; + + LOCK (&inode->lock); + { + ctx = __afr_inode_ctx_get (inode, this); + ctx->open_fd_count = local->open_fd_count; + } + UNLOCK (&inode->lock); +} -- cgit