summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr
diff options
context:
space:
mode:
authorVijay Bellur <vijay@gluster.com>2012-03-03 00:01:23 -0800
committerVijay Bellur <vijay@gluster.com>2012-03-03 05:01:40 -0800
commit7fec9b41d8e1befa8d58a76d98207debddd60b65 (patch)
treed0f503c0dbffc53dbf22c91d7e1c70d0c4405db0 /xlators/cluster/afr
parentaaac9cf176b407f89a1e8015140916b3f9d3cddb (diff)
Revert "afr: [Un]Set the 'right' lkowner for [f]{inode|entry}_lk and the 'enclosed' fop."
This reverts commit 2e80fdbeb6abbb23ff6789c2b98c82704883af0a. Change-Id: I417fd43e4195d63e5b8b83dd3beb712887130e1e Reviewed-on: http://review.gluster.com/2860 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr')
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c91
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c1
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c1
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c2
-rw-r--r--xlators/cluster/afr/src/afr.h10
-rw-r--r--xlators/cluster/afr/src/pump.c11
6 files changed, 22 insertions, 94 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))
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index a70d2754b18..de89f88cf12 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -2077,6 +2077,7 @@ afr_self_heal (call_frame_t *frame, xlator_t *this, inode_t *inode)
sh_frame = copy_frame (frame);
if (!sh_frame)
goto out;
+ afr_set_lk_owner (sh_frame, this);
afr_set_low_priority (sh_frame);
sh_local = afr_local_copy (local, this);
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 34376b1853d..36d2cfb6ee5 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -1032,6 +1032,7 @@ afr_start_crawl (xlator_t *this, int idx, afr_crawl_type_t crawl,
if (!frame)
goto out;
+ afr_set_lk_owner (frame, this);
afr_set_low_priority (frame);
crawl_data = GF_CALLOC (1, sizeof (*crawl_data),
gf_afr_mt_crawl_data_t);
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index eb41c51841c..36e2812f968 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -1168,6 +1168,8 @@ afr_lock (call_frame_t *frame, xlator_t *this)
frame->root->pid = (long) frame->root;
+ afr_set_lk_owner (frame, this);
+
afr_set_lock_number (frame, this);
return afr_lock_rec (frame, this);
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index fc77b806e2f..a1c1bb39846 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -336,9 +336,6 @@ afr_index_for_transaction_type (afr_transaction_type type)
typedef struct {
loc_t *lk_loc;
struct gf_flock lk_flock;
- gf_lkowner_t fop_lkowner; /* 'copy' of fop's lk_owner to protect
- against afr internal locks 'irreversibly'
- overloading lk_owner.*/
const char *lk_basename;
const char *lower_basename;
@@ -773,12 +770,7 @@ afr_mark_locked_nodes (xlator_t *this, fd_t *fd,
unsigned char *locked_nodes);
void
-afr_set_lk_owner (call_frame_t *frame, xlator_t *this,
- afr_internal_lock_t *int_lock);
-
-void
-afr_unset_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);
int
afr_set_lock_number (call_frame_t *frame, xlator_t *this);
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index bc95791004b..e795c38e096 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -696,14 +696,15 @@ pump_task_completion (int ret, call_frame_t *sync_frame, void *data)
int
pump_start (call_frame_t *pump_frame, xlator_t *this)
{
- afr_private_t *priv = NULL;
- pump_private_t *pump_priv = NULL;
- int ret = -1;
+ afr_private_t *priv = NULL;
+ pump_private_t *pump_priv = NULL;
- priv = this->private;
+ int ret = -1;
+
+ priv = this->private;
pump_priv = priv->pump_private;
- afr_set_lk_owner (pump_frame, this, NULL);
+ afr_set_lk_owner (pump_frame, this);
pump_pid = (uint64_t) (unsigned long)pump_frame->root;
ret = synctask_new (pump_priv->env, pump_task,