summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorRaghavendra Talur <rtalur@redhat.com>2017-07-18 11:36:19 +0530
committerJeff Darcy <jeff@pl.atyp.us>2017-07-19 14:16:19 +0000
commit33db9aff1deaa028f30516e49fdb1e8d6e31bb73 (patch)
tree36d88c93e1e83e4253b154199b0b12531d0edb39 /xlators/features
parent5ccf0922208c368873120e235be0fd2975a589c1 (diff)
libglusterfs: Name threads on creation
Set names to threads on creation for easier debugging. Output of top -H -p <PID-OF-GLUSTERFSD> Before: 19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd 19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd After: 19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustertimer 19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd 19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustermemsweep 19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc0 19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc1 19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll0 19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteridxwrker 19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteriotwr0 19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrssign 19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrswrker 19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterclogecon 19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd0 19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd1 19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd2 19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixjan 19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixfsy 25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll1 5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll2 7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixhc Change-Id: Id5f333755c1ba168a2ffaa4fce6e71c375e10703 BUG: 1254002 Updates: #271 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: https://review.gluster.org/11926 Reviewed-by: Prashanth Pai <ppai@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c6
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c11
-rw-r--r--xlators/features/bit-rot/src/stub/bit-rot-stub.c6
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog-journal-handler.c4
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog.c8
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c13
-rw-r--r--xlators/features/changelog/src/changelog-rpc.c13
-rw-r--r--xlators/features/changelog/src/changelog.c5
-rw-r--r--xlators/features/changetimerecorder/src/changetimerecorder.c5
-rw-r--r--xlators/features/index/src/index.c3
-rw-r--r--xlators/features/leases/src/leases.c4
-rw-r--r--xlators/features/quiesce/src/quiesce.c5
-rw-r--r--xlators/features/upcall/src/upcall-internal.c4
13 files changed, 55 insertions, 32 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index e043ef8..8812e99 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -1299,7 +1299,8 @@ br_scrubber_scale_up (xlator_t *this,
INIT_LIST_HEAD (&scrub->list);
ret = gf_thread_create (&scrub->scrubthread,
- NULL, br_scrubber_proc, fsscrub);
+ NULL, br_scrubber_proc, fsscrub,
+ "brsproc");
if (ret)
break;
@@ -1976,7 +1977,8 @@ br_scrubber_monitor_init (xlator_t *this, br_private_t *priv)
br_set_scrub_state (&priv->scrub_monitor, BR_SCRUB_STATE_INACTIVE);
/* Start the monitor thread */
- ret = gf_thread_create (&scrub_monitor->thread, NULL, br_monitor_thread, this);
+ ret = gf_thread_create (&scrub_monitor->thread, NULL,
+ br_monitor_thread, this, "brmon");
if (ret != 0) {
gf_msg (this->name, GF_LOG_ERROR, -ret,
BRB_MSG_SPAWN_FAILED, "monitor thread creation failed");
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index c591db5..3c42cb2 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -1133,7 +1133,8 @@ br_enact_signer (xlator_t *this, br_child_t *child, br_stub_init_t *stub)
}
child->threadrunning = 0;
- ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child);
+ ret = gf_thread_create (&child->thread, NULL, br_oneshot_signer, child,
+ "brosign");
if (ret)
gf_msg (this->name, GF_LOG_WARNING, 0, BRB_MSG_SPAWN_FAILED,
"failed to spawn FS crawler thread");
@@ -1161,7 +1162,8 @@ br_launch_scrubber (xlator_t *this, br_child_t *child,
priv = this->private;
scrub_monitor = &priv->scrub_monitor;
- ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child);
+ ret = gf_thread_create (&child->thread, NULL, br_fsscanner, child,
+ "brfsscan");
if (ret != 0) {
gf_msg (this->name, GF_LOG_ALERT, 0, BRB_MSG_SPAWN_FAILED,
"failed to spawn bitrot scrubber daemon [Brick: %s]",
@@ -1750,7 +1752,7 @@ br_init_signer (xlator_t *this, br_private_t *priv)
for (i = 0; i < BR_WORKERS; i++) {
ret = gf_thread_create (&priv->obj_queue->workers[i], NULL,
- br_process_object, this);
+ br_process_object, this, "brpobj");
if (ret != 0) {
gf_msg (this->name, GF_LOG_ERROR, -ret,
BRB_MSG_SPAWN_FAILED, "thread creation"
@@ -2021,7 +2023,8 @@ init (xlator_t *this)
if (ret)
goto cleanup;
- ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this);
+ ret = gf_thread_create (&priv->thread, NULL, br_handle_events, this,
+ "brhevent");
if (ret != 0) {
gf_msg (this->name, GF_LOG_ERROR, -ret,
BRB_MSG_SPAWN_FAILED, "thread creation failed");
diff --git a/xlators/features/bit-rot/src/stub/bit-rot-stub.c b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
index b8a3442..fb187a3 100644
--- a/xlators/features/bit-rot/src/stub/bit-rot-stub.c
+++ b/xlators/features/bit-rot/src/stub/bit-rot-stub.c
@@ -97,7 +97,8 @@ br_stub_bad_object_container_init (xlator_t *this, br_stub_private_t *priv)
if (ret < 0)
goto cleanup_lock;
- ret = gf_thread_create (&priv->container.thread, &w_attr, br_stub_worker, this);
+ ret = gf_thread_create (&priv->container.thread, &w_attr,
+ br_stub_worker, this, "brswrker");
if (ret)
goto cleanup_attr;
@@ -158,7 +159,8 @@ init (xlator_t *this)
*/
this->private = priv;
- ret = gf_thread_create (&priv->signth, NULL, br_stub_signth, this);
+ ret = gf_thread_create (&priv->signth, NULL, br_stub_signth, this,
+ "brssign");
if (ret != 0)
goto cleanup_lock;
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 2f197ee..e490069 100644
--- a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
+++ b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c
@@ -805,8 +805,8 @@ gf_changelog_init_processor (gf_changelog_journal_t *jnl)
jnl_proc->waiting = _gf_false;
jnl->jnl_proc = jnl_proc;
- ret = pthread_create (&jnl_proc->processor,
- NULL, gf_changelog_process, jnl);
+ ret = gf_thread_create (&jnl_proc->processor,
+ NULL, gf_changelog_process, jnl, "clogproc");
if (ret != 0) {
jnl->jnl_proc = NULL;
goto cleanup_cond;
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c
index 7589163..0e5a2c8 100644
--- a/xlators/features/changelog/lib/src/gf-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-changelog.c
@@ -307,7 +307,7 @@ gf_init_event (gf_changelog_t *entry)
}
ret = gf_thread_create (&ev->invoker, NULL,
- gf_changelog_callback_invoker, ev);
+ gf_changelog_callback_invoker, ev, "clogcbki");
if (ret != 0) {
entry->pickevent = NULL;
entry->queueevent = NULL;
@@ -462,7 +462,8 @@ gf_changelog_set_master (xlator_t *master, void *xl)
if (!xl) {
/* poller thread */
ret = gf_thread_create (&priv->poller,
- NULL, changelog_rpc_poller, THIS);
+ NULL, changelog_rpc_poller, THIS,
+ "clogpoll");
if (ret != 0) {
GF_FREE (priv);
gf_msg (master->name, GF_LOG_ERROR, 0,
@@ -503,7 +504,8 @@ gf_changelog_init (void *xl)
priv = master->private;
ret = gf_thread_create (&priv->connectionjanitor, NULL,
- gf_changelog_connection_janitor, master);
+ gf_changelog_connection_janitor, master,
+ "clogjan");
if (ret != 0) {
/* TODO: cleanup priv, mutex (poller thread for !xl) */
goto dealloc_name;
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index 0c23200..4355396 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -569,6 +569,7 @@ gf_history_consume (void * data)
gf_changelog_history_data_t *hist_data = NULL;
gf_changelog_consume_data_t ccd[MAX_PARALLELS] = {{0},};
gf_changelog_consume_data_t *curr = NULL;
+ char thread_name[GF_THREAD_NAMEMAX] = {0,};
hist_data = (gf_changelog_history_data_t *) data;
if (hist_data == NULL) {
@@ -614,9 +615,12 @@ gf_history_consume (void * data)
curr->retval = 0;
memset (curr->changelog, '\0', PATH_MAX);
+ snprintf (thread_name, sizeof(thread_name), "%s%d",
+ "clogc", iter + 1);
- ret = pthread_create (&th_id[iter], NULL,
- gf_changelog_consume_wrap, curr);
+ ret = gf_thread_create (&th_id[iter], NULL,
+ gf_changelog_consume_wrap, curr,
+ thread_name);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, ret,
CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED
@@ -953,8 +957,9 @@ gf_history_changelog (char* changelog_dir, unsigned long start,
}
/* spawn a thread for background parsing & publishing */
- ret = pthread_create (&consume_th, &attr,
- gf_history_consume, hist_data);
+ ret = gf_thread_create (&consume_th, &attr,
+ gf_history_consume, hist_data,
+ "cloghcon");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, ret,
CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED
diff --git a/xlators/features/changelog/src/changelog-rpc.c b/xlators/features/changelog/src/changelog-rpc.c
index 4145608..5524e43 100644
--- a/xlators/features/changelog/src/changelog-rpc.c
+++ b/xlators/features/changelog/src/changelog-rpc.c
@@ -71,6 +71,8 @@ changelog_init_rpc_threads (xlator_t *this, changelog_priv_t *priv,
int j = 0;
int ret = 0;
changelog_clnt_t *conn = NULL;
+ char thread_name[GF_THREAD_NAMEMAX] = {0,};
+
conn = &priv->connections;
@@ -97,8 +99,8 @@ changelog_init_rpc_threads (xlator_t *this, changelog_priv_t *priv,
goto cleanup_active_lock;
/* spawn reverse connection thread */
- ret = pthread_create (&priv->connector,
- NULL, changelog_ev_connector, conn);
+ ret = gf_thread_create (&priv->connector,
+ NULL, changelog_ev_connector, conn, "clogecon");
if (ret != 0)
goto cleanup_wait_lock;
@@ -110,8 +112,11 @@ changelog_init_rpc_threads (xlator_t *this, changelog_priv_t *priv,
/* spawn dispatcher threads */
for (; j < nr_dispatchers; j++) {
- ret = pthread_create (&priv->ev_dispatcher[j],
- NULL, changelog_ev_dispatch, conn);
+ snprintf (thread_name, sizeof(thread_name),
+ "%s%d", "clogd", j);
+ ret = gf_thread_create (&priv->ev_dispatcher[j],
+ NULL, changelog_ev_dispatch, conn,
+ thread_name);
if (ret != 0) {
changelog_cleanup_dispatchers (this, priv, j);
break;
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index 8758b76..8b22a04 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -2073,14 +2073,15 @@ changelog_spawn_helper_threads (xlator_t *this, changelog_priv_t *priv)
priv->cr.notify = _gf_false;
priv->cr.this = this;
ret = gf_thread_create (&priv->cr.rollover_th,
- NULL, changelog_rollover, priv);
+ NULL, changelog_rollover, priv, "clogro");
if (ret)
goto out;
if (priv->fsync_interval) {
priv->cf.this = this;
ret = gf_thread_create (&priv->cf.fsync_th,
- NULL, changelog_fsync_thread, priv);
+ NULL, changelog_fsync_thread, priv,
+ "clogfsyn");
}
if (ret)
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
index 7598e43..1b13607 100644
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
@@ -2012,8 +2012,9 @@ ctr_ipc_helper (xlator_t *this, dict_t *in_dict,
goto out;
}
- ret = pthread_create (&compact_thread, NULL, ctr_compact_thread,
- (void *)this);
+ ret = gf_thread_create (&compact_thread, NULL,
+ ctr_compact_thread, (void *)this,
+ "ctrcomp");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0, CTR_MSG_SET,
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index cb81b16..8590482 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -2403,7 +2403,8 @@ init (xlator_t *this)
index_set_link_count (priv, count, XATTROP);
priv->down = _gf_false;
- ret = gf_thread_create (&priv->thread, &w_attr, index_worker, this);
+ ret = gf_thread_create (&priv->thread, &w_attr, index_worker, this,
+ "idxwrker");
if (ret) {
gf_msg (this->name, GF_LOG_WARNING, ret,
INDEX_MSG_WORKER_THREAD_CREATE_FAILED,
diff --git a/xlators/features/leases/src/leases.c b/xlators/features/leases/src/leases.c
index faffa0e..551dd9b 100644
--- a/xlators/features/leases/src/leases.c
+++ b/xlators/features/leases/src/leases.c
@@ -965,8 +965,8 @@ leases_init_priv (xlator_t *this)
}
if (!priv->inited_recall_thr) {
- pthread_create (&priv->recall_thr, NULL,
- expired_recall_cleanup, this);
+ gf_thread_create (&priv->recall_thr, NULL,
+ expired_recall_cleanup, this, "leasercl");
priv->inited_recall_thr = _gf_true;
}
diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c
index 3a4100f..f821781 100644
--- a/xlators/features/quiesce/src/quiesce.c
+++ b/xlators/features/quiesce/src/quiesce.c
@@ -2496,8 +2496,9 @@ notify (xlator_t *this, int event, void *data, ...)
switch (event) {
case GF_EVENT_CHILD_UP:
{
- ret = pthread_create (&priv->thr, NULL, gf_quiesce_dequeue_start,
- this);
+ ret = gf_thread_create (&priv->thr, NULL,
+ gf_quiesce_dequeue_start,
+ this, "quiesce");
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"failed to create the quiesce-dequeue thread");
diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c
index 285141d..8b15dfc 100644
--- a/xlators/features/upcall/src/upcall-internal.c
+++ b/xlators/features/upcall/src/upcall-internal.c
@@ -431,8 +431,8 @@ upcall_reaper_thread_init (xlator_t *this)
priv = this->private;
GF_ASSERT (priv);
- ret = pthread_create (&priv->reaper_thr, NULL,
- upcall_reaper_thread, this);
+ ret = gf_thread_create (&priv->reaper_thr, NULL,
+ upcall_reaper_thread, this, "upreaper");
return ret;
}