summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-lk-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src/afr-lk-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c91
1 files changed, 11 insertions, 80 deletions
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 3614aa128a2..39646ff85b9 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -31,14 +31,6 @@
#define LOCKED_YES 0x1 /* for DATA, METADATA, ENTRY and higher_path */
#define LOCKED_LOWER 0x2 /* for lower path */
-static inline void
-afr_unset_lk_owner_and_call_cbk (call_frame_t *frame, xlator_t *this,
- afr_internal_lock_t *int_lock)
-{
- afr_unset_lk_owner (frame, this, int_lock);
- int_lock->lock_cbk (frame, this);
-}
-
int
afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index);
@@ -64,58 +56,14 @@ afr_set_lock_number (call_frame_t *frame, xlator_t *this)
return 0;
}
-static void
-afr_lkowner_trace_log (xlator_t *this, gf_lkowner_t *from, gf_lkowner_t *to)
-{
- char from_lkowner[1024] = {0, };
- char to_lkowner[1024] = {0, };
- afr_private_t *priv = NULL;
-
- priv = this->private;
-
- if (!priv->entrylk_trace && !priv->inodelk_trace)
- return;
-
- lkowner_utoa_r (from, from_lkowner, sizeof (from_lkowner));
- lkowner_utoa_r (to, to_lkowner, sizeof (to_lkowner));
-
- gf_log (this->name, GF_LOG_INFO, "Changing lk-owner from %s to %s",
- from_lkowner, to_lkowner);
-}
-
void
-afr_set_lk_owner (call_frame_t *frame, xlator_t *this,
- afr_internal_lock_t *int_lock)
+afr_set_lk_owner (call_frame_t *frame, xlator_t *this)
{
-
- if (int_lock)
- memcpy (&int_lock->fop_lkowner, &frame->root->lk_owner,
- sizeof (int_lock->fop_lkowner));
+ gf_log (this->name, GF_LOG_TRACE,
+ "Setting lk-owner=%llu",
+ (unsigned long long) (unsigned long)frame->root);
set_lk_owner_from_ptr (&frame->root->lk_owner, frame->root);
-
- afr_lkowner_trace_log (this, &int_lock->fop_lkowner,
- &frame->root->lk_owner);
-}
-
-void
-afr_unset_lk_owner (call_frame_t *frame, xlator_t *this,
- afr_internal_lock_t *int_lock)
-{
- if (!int_lock) {
- gf_log (this->name, GF_LOG_CRITICAL, "Attempting to unset "
- "lk_owner without saved fop lk_owner");
- goto out;
- }
-
- memcpy (&frame->root->lk_owner, &int_lock->fop_lkowner,
- sizeof (int_lock->fop_lkowner));
-
- afr_lkowner_trace_log (this, &int_lock->fop_lkowner,
- &frame->root->lk_owner);
-
-out:
- return;
}
static int
@@ -515,8 +463,6 @@ initialize_entrylk_variables (call_frame_t *frame, xlator_t *this)
int_lock->entry_locked_nodes[i] = 0;
}
- afr_set_lk_owner (frame, this, int_lock);
-
return 0;
}
@@ -540,8 +486,6 @@ initialize_inodelk_variables (call_frame_t *frame, xlator_t *this)
int_lock->inode_locked_nodes[i] = 0;
}
- afr_set_lk_owner (frame, this, int_lock);
-
return 0;
}
@@ -597,7 +541,7 @@ afr_unlock_common_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (call_count == 0) {
gf_log (this->name, GF_LOG_TRACE,
"All internal locks unlocked");
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
}
return 0;
@@ -670,7 +614,7 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
if (!call_count) {
gf_log (this->name, GF_LOG_TRACE,
"No internal locks unlocked");
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
goto out;
}
@@ -790,7 +734,7 @@ afr_unlock_entrylk (call_frame_t *frame, xlator_t *this)
if (!call_count){
gf_log (this->name, GF_LOG_TRACE,
"No internal locks unlocked");
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
goto out;
}
@@ -848,7 +792,6 @@ afr_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((op_ret == -1) &&
(op_errno == ENOSYS)) {
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock (frame, this);
} else {
if (op_ret == 0) {
@@ -909,7 +852,6 @@ afr_lock_lower_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
UNLOCK (&frame->lock);
if (op_ret != 0) {
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock (frame, this);
goto out;
} else {
@@ -1025,7 +967,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
afr_copy_locked_nodes (frame, this);
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock (frame, this);
return 0;
@@ -1057,7 +998,6 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
afr_copy_locked_nodes (frame, this);
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock(frame, this);
return 0;
@@ -1075,7 +1015,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
afr_copy_locked_nodes (frame, this);
int_lock->lock_op_ret = 0;
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
return 0;
}
@@ -1250,7 +1190,7 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_log (this->name, GF_LOG_TRACE,
"All servers locked. Calling the cbk");
int_lock->lock_op_ret = 0;
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
}
/* Not all locks were successful. Unlock and try locking
again, this time with serially blocking locks */
@@ -1259,7 +1199,6 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"%d servers locked. Trying again with blocking calls",
int_lock->lock_count);
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock(frame, this);
}
}
@@ -1326,7 +1265,6 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
if (!call_count) {
gf_log (this->name, GF_LOG_INFO,
"fd not open on any subvolumes. aborting.");
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock (frame, this);
goto out;
}
@@ -1445,7 +1383,7 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_log (this->name, GF_LOG_TRACE,
"All servers locked. Calling the cbk");
int_lock->lock_op_ret = 0;
- afr_unset_lk_owner_and_call_cbk (frame, this, int_lock);
+ int_lock->lock_cbk (frame, this);
}
/* Not all locks were successful. Unlock and try locking
again, this time with serially blocking locks */
@@ -1454,7 +1392,6 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"%d servers locked. Trying again with blocking calls",
int_lock->lock_count);
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock(frame, this);
}
}
@@ -1517,7 +1454,6 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
if (!call_count) {
gf_log (this->name, GF_LOG_INFO,
"fd not open on any subvolumes. aborting.");
- afr_unset_lk_owner (frame, this, int_lock);
afr_unlock (frame, this);
goto out;
}
@@ -1711,7 +1647,6 @@ afr_post_unlock_lower_cbk (call_frame_t *frame, xlator_t *this)
local = frame->local;
int_lock = &local->internal_lock;
- afr_set_lk_owner (frame, this, int_lock);
lower = lower_path (&local->transaction.parent_loc,
local->transaction.basename,
@@ -1789,13 +1724,9 @@ afr_rename_transaction (call_frame_t *frame, xlator_t *this)
int32_t
afr_unlock (call_frame_t *frame, xlator_t *this)
{
- afr_local_t *local = NULL;
- afr_internal_lock_t *int_lock = NULL;
+ afr_local_t *local = NULL;
local = frame->local;
- int_lock = &local->internal_lock;
-
- afr_set_lk_owner (frame, this, int_lock);
if (transaction_lk_op (local)) {
if (is_afr_lock_transaction (local))