summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog-journal-handler.c5
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog-journal.h2
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog.c5
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c4
4 files changed, 12 insertions, 4 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
index 65ee9555514..538a7faff68 100644
--- a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
+++ b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
@@ -583,10 +583,10 @@ gf_changelog_process (void *data)
gf_changelog_entry_t *entry = NULL;
gf_changelog_processor_t *jnl_proc = NULL;
- this = THIS;
-
jnl = data;
jnl_proc = jnl->jnl_proc;
+ THIS = jnl->this;
+ this = jnl->this;
while (1) {
pthread_mutex_lock (&jnl_proc->lock);
@@ -961,6 +961,7 @@ gf_changelog_journal_init (void *xl, struct gf_brick_spec *brick)
goto cleanup_fds;
/* initialize journal processor */
+ jnl->this = this;
ret = gf_changelog_init_processor (jnl);
if (ret)
goto cleanup_fds;
diff --git a/xlators/features/changelog/lib/src/gf-changelog-journal.h b/xlators/features/changelog/lib/src/gf-changelog-journal.h
index 9a0f0b28956..e91807c80b6 100644
--- a/xlators/features/changelog/lib/src/gf-changelog-journal.h
+++ b/xlators/features/changelog/lib/src/gf-changelog-journal.h
@@ -61,6 +61,7 @@ typedef struct gf_changelog_journal {
pthread_spinlock_t lock;
int connected;
+ xlator_t *this;
} gf_changelog_journal_t;
#define JNL_SET_API_STATE(jnl, state) (jnl->connected = state)
@@ -78,6 +79,7 @@ typedef struct gf_changelog_history_data {
/* history from, to indexes */
unsigned long from;
unsigned long to;
+ xlator_t *this;
} gf_changelog_history_data_t;
typedef struct gf_changelog_consume_data {
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c
index 103a7b01eb0..f2a5135e12a 100644
--- a/xlators/features/changelog/lib/src/gf-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-changelog.c
@@ -589,7 +589,10 @@ gf_changelog_register (char *brick_path, char *scratch_dir,
{
struct gf_brick_spec brick = {0,};
- THIS = master;
+ if (master)
+ THIS = master;
+ else
+ return -1;
brick.brick_path = brick_path;
brick.filter = CHANGELOG_OP_TYPE_JOURNAL;
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index 9b1da843b49..50afb3fe0c7 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -554,7 +554,8 @@ gf_history_consume (void * data)
len = hist_data->len;
n_parallel = hist_data->n_parallel;
- this = THIS;
+ THIS = hist_data->this;
+ this = hist_data->this;
if (!this) {
ret = -1;
goto out;
@@ -883,6 +884,7 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
hist_data->to = to;
hist_data->len = len;
hist_data->n_parallel = n_parallel;
+ hist_data->this = this;
ret = pthread_attr_setdetachstate
(&attr, PTHREAD_CREATE_DETACHED);