summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2014-07-18 15:36:42 +0530
committerVijay Bellur <vbellur@redhat.com>2014-07-23 16:15:21 -0700
commit8a24b1487d440c23b00b56aba5b9bfb77af6ef03 (patch)
treef71ac65c27cc56a2a3c95f3ce63d79c13af36dea
parent1706151a42ce92057b01f4c6869bf66c65769021 (diff)
features/changelog: Capture "correct" internal FOPs
This patch fixes changelog capturing internal FOPs in a cascaded setup, where the intermediate master would record internal FOPs (generated by DHT on link()/rename()). This is due to I/O happening on the intermediate slave on geo-replication's auxillary mount with client-pid -1. Currently, the internal FOP capturing logic depends on client pid being non-negative and the presence of a special key in dictionary. Due to this, internal FOPs on an inter-mediate master would be recorded in the changelog. Checking client-pid being non-negative was introduced to capture AFR self-heal traffic in changelog, thereby breaking cascading setups. By coincidence, AFR self-heal daemon uses -1 as frame->root->pid thereby making is hard to differentiate b/w geo-rep's auxillary mount and self-heal daemon. Change-Id: Ib7bd71e80dd1856770391edb621ba9819cab7056 BUG: 1122037 Original-Author: Venky Shankar <vshankar@redhat.com> Signed-off-by: Kotresh H R <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/8347 Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--libglusterfs/src/common-utils.h1
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c8
-rw-r--r--xlators/features/changelog/src/changelog-helpers.h13
4 files changed, 15 insertions, 11 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 1ddb46c6758..98f30fc47b0 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -114,6 +114,7 @@ enum _gf_client_pid
GF_CLIENT_PID_DEFRAG = -3,
GF_CLIENT_PID_NO_ROOT_SQUASH = -4,
GF_CLIENT_PID_QUOTA_MOUNT = -5,
+ GF_CLIENT_PID_AFR_SELF_HEALD = -6,
};
typedef enum _gf_boolean gf_boolean_t;
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index e4fbe794f08..04191649b4c 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -514,7 +514,7 @@ afr_inode_refresh_done (call_frame_t *frame, xlator_t *this)
if (ret && afr_selfheal_enabled (this)) {
heal = copy_frame (frame);
if (heal)
- heal->root->pid = -1;
+ heal->root->pid = GF_CLIENT_PID_AFR_SELF_HEALD;
ret = synctask_new (this->ctx->env, afr_refresh_selfheal_wrap,
afr_refresh_selfheal_done, heal, frame);
if (ret)
@@ -1494,7 +1494,7 @@ afr_lookup_entry_heal (call_frame_t *frame, xlator_t *this)
if (need_heal) {
heal = copy_frame (frame);
if (heal)
- heal->root->pid = -1;
+ heal->root->pid = GF_CLIENT_PID_AFR_SELF_HEALD;
ret = synctask_new (this->ctx->env, afr_lookup_selfheal_wrap,
afr_refresh_selfheal_done, heal, frame);
if (ret)
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 56691e27752..1d0831f0752 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -947,10 +947,10 @@ afr_inode_find (xlator_t *this, uuid_t gfid)
call_frame_t *
afr_frame_create (xlator_t *this)
{
- call_frame_t *frame = NULL;
- afr_local_t *local = NULL;
- int op_errno = 0;
- pid_t pid = -1;
+ call_frame_t *frame = NULL;
+ afr_local_t *local = NULL;
+ int op_errno = 0;
+ pid_t pid = GF_CLIENT_PID_AFR_SELF_HEALD;
frame = create_frame (this, this->ctx->pool);
if (!frame)
diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h
index 95f369bf936..87888fb8c4f 100644
--- a/xlators/features/changelog/src/changelog-helpers.h
+++ b/xlators/features/changelog/src/changelog-helpers.h
@@ -521,11 +521,14 @@ int __chlog_barrier_enable (xlator_t *this, changelog_priv_t *priv);
goto label; \
} while (0)
-/* ignore internal fops */
-#define CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label) do { \
- if ((frame->root->pid > 0) && \
- dict && dict_get (dict, GLUSTERFS_INTERNAL_FOP_KEY)) \
- goto label; \
+/**
+ * ignore internal fops for all clients except AFR self-heal daemon
+ */
+#define CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO(frame, dict, label) do { \
+ if ((frame->root->pid != GF_CLIENT_PID_AFR_SELF_HEALD) \
+ && dict \
+ && dict_get (dict, GLUSTERFS_INTERNAL_FOP_KEY)) \
+ goto label; \
} while (0)
#define CHANGELOG_COND_GOTO(priv, cond, label) do { \