summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--xlators/features/changelog/src/changelog.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index bb9c51a2a0b..6c7a0a80f17 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -2489,7 +2489,8 @@ changelog_cleanup_rpc (xlator_t *this, changelog_priv_t *priv)
rbuf_dtor (priv->rbuf);
/* cleanup poller thread */
- (void) changelog_thread_cleanup (this, priv->poller);
+ if (priv->poller)
+ (void) changelog_thread_cleanup (this, priv->poller);
}
static int
@@ -2504,13 +2505,6 @@ changelog_init_rpc (xlator_t *this, changelog_priv_t *priv)
/* initialize event selection */
changelog_init_event_selection (this, selection);
- ret = pthread_create (&priv->poller, NULL, changelog_rpc_poller, this);
- if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "failed to spawn poller thread");
- goto error_return;
- }
-
priv->rbuf = rbuf_init (NR_ROTT_BUFFS);
if (!priv->rbuf)
goto cleanup_thread;
@@ -2526,8 +2520,9 @@ changelog_init_rpc (xlator_t *this, changelog_priv_t *priv)
cleanup_rbuf:
rbuf_dtor (priv->rbuf);
cleanup_thread:
- (void) changelog_thread_cleanup (this, priv->poller);
- error_return:
+ if (priv->poller)
+ (void) changelog_thread_cleanup (this, priv->poller);
+
return -1;
}