summaryrefslogtreecommitdiffstats
path: root/xlators
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
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')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c2
-rw-r--r--xlators/cluster/dht/src/dht-common.c3
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c19
-rw-r--r--xlators/cluster/dht/src/tier.c20
-rw-r--r--xlators/cluster/ec/src/ec-heald.c2
-rw-r--r--xlators/debug/io-stats/src/io-stats.c8
-rw-r--r--xlators/experimental/fdl/src/fdl-tmpl.c3
-rw-r--r--xlators/experimental/jbr-server/src/jbr.c4
-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
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-hooks.c4
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c5
-rw-r--r--xlators/nfs/server/src/mount3.c8
-rw-r--r--xlators/nfs/server/src/nlm4.c5
-rw-r--r--xlators/performance/io-threads/src/io-threads.c6
-rw-r--r--xlators/storage/bd/src/bd-aio.c4
-rw-r--r--xlators/storage/posix/src/posix-aio.c2
-rw-r--r--xlators/storage/posix/src/posix-helpers.c6
-rw-r--r--xlators/storage/posix/src/posix.c3
30 files changed, 114 insertions, 77 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 0881720..74c9bb6 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -685,7 +685,7 @@ afr_shd_healer_spawn (xlator_t *this, struct subvol_healer *healer,
pthread_cond_signal (&healer->cond);
} else {
ret = gf_thread_create (&healer->thread, NULL,
- threadfn, healer);
+ threadfn, healer, "shdheal");
if (ret)
goto unlock;
healer->running = 1;
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 6aa9b13..253fd71 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -9290,7 +9290,8 @@ unlock:
run_defrag = 1;
ret = gf_thread_create(&conf->defrag->th,
NULL,
- gf_defrag_start, this);
+ gf_defrag_start, this,
+ "dhtdg");
if (ret) {
GF_FREE (conf->defrag);
conf->defrag = NULL;
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index 2e80ada..6a9153f 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -3988,8 +3988,9 @@ gf_tier_start_fix_layout (xlator_t *this,
/* Spawn the fix layout thread so that its done in the
* background */
- ret = pthread_create (&tier_fix_layout_arg->thread_id, NULL,
- gf_tier_do_fix_layout, tier_fix_layout_arg);
+ ret = gf_thread_create (&tier_fix_layout_arg->thread_id, NULL,
+ gf_tier_do_fix_layout,
+ tier_fix_layout_arg, "tierfixl");
if (ret) {
gf_log ("tier", GF_LOG_ERROR, "Thread creation failed. "
"Background fix layout for tiering will not "
@@ -4282,6 +4283,7 @@ gf_defrag_start_crawl (void *data)
int err = 0;
int thread_spawn_count = 0;
pthread_t *tid = NULL;
+ char thread_name[GF_THREAD_NAMEMAX] = {0,};
pthread_t filecnt_thread;
gf_boolean_t is_tier_detach = _gf_false;
call_frame_t *statfs_frame = NULL;
@@ -4447,9 +4449,9 @@ gf_defrag_start_crawl (void *data)
"time to complete rebalance.");
}
- ret = pthread_create (&filecnt_thread, NULL,
- &dht_file_counter_thread,
- (void *)defrag);
+ ret = gf_thread_create (&filecnt_thread, NULL,
+ &dht_file_counter_thread,
+ (void *)defrag, "dhtfcnt");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, ret, 0, "Failed to "
@@ -4491,8 +4493,11 @@ gf_defrag_start_crawl (void *data)
/*Spawn Threads Here*/
while (thread_index < thread_spawn_count) {
- err = pthread_create(&(tid[thread_index]), NULL,
- &gf_defrag_task, (void *)defrag);
+ snprintf (thread_name, sizeof(thread_name),
+ "%s%d", "dhtdf", thread_index + 1);
+ err = gf_thread_create (&(tid[thread_index]), NULL,
+ &gf_defrag_task, (void *)defrag,
+ thread_name);
if (err != 0) {
gf_log ("DHT", GF_LOG_ERROR,
"Thread[%d] creation failed. "
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index c866722..db23b96 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -2577,9 +2577,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
demotion_args.is_promotion = _gf_false;
demotion_args.is_compaction = _gf_false;
- ret = pthread_create (&demote_thread,
- NULL, &tier_run,
- &demotion_args);
+ ret = gf_thread_create (&demote_thread,
+ NULL, &tier_run, &demotion_args, "tierdem");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2596,9 +2595,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
promotion_args.defrag = defrag;
promotion_args.is_promotion = _gf_true;
- ret = pthread_create (&promote_thread,
- NULL, &tier_run,
- &promotion_args);
+ ret = gf_thread_create (&promote_thread, NULL, &tier_run,
+ &promotion_args, "tierpro");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2614,9 +2612,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
hot_compaction_args.is_compaction = _gf_true;
hot_compaction_args.is_hot_tier = _gf_true;
- ret = pthread_create (&hot_compact_thread,
- NULL, &tier_run,
- &hot_compaction_args);
+ ret = gf_thread_create (&hot_compact_thread, NULL, &tier_run,
+ &hot_compaction_args, "tierhcom");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
@@ -2632,9 +2629,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
cold_compaction_args.is_compaction = _gf_true;
cold_compaction_args.is_hot_tier = _gf_false;
- ret = pthread_create (&cold_compact_thread,
- NULL, &tier_run,
- &cold_compaction_args);
+ ret = gf_thread_create (&cold_compact_thread, NULL, &tier_run,
+ &cold_compaction_args, "tierccom");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
DHT_MSG_LOG_TIER_ERROR,
diff --git a/xlators/cluster/ec/src/ec-heald.c b/xlators/cluster/ec/src/ec-heald.c
index 2e8ece8..b4fa6f8 100644
--- a/xlators/cluster/ec/src/ec-heald.c
+++ b/xlators/cluster/ec/src/ec-heald.c
@@ -442,7 +442,7 @@ ec_shd_healer_spawn (xlator_t *this, struct subvol_healer *healer,
pthread_cond_signal (&healer->cond);
} else {
ret = gf_thread_create (&healer->thread, NULL,
- threadfn, healer);
+ threadfn, healer, "ecshd");
if (ret)
goto unlock;
healer->running = 1;
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 6f63827..a46d116 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3823,8 +3823,8 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("ios-dump-interval", conf->ios_dump_interval, options,
int32, out);
if ((old_dump_interval <= 0) && (conf->ios_dump_interval > 0)) {
- pthread_create (&conf->dump_thread, NULL,
- (void *) &_ios_dump_thread, this);
+ gf_thread_create (&conf->dump_thread, NULL,
+ (void *) &_ios_dump_thread, this, "iosdump");
}
GF_OPTION_RECONF ("ios-sample-interval", conf->ios_sample_interval,
@@ -4047,8 +4047,8 @@ init (xlator_t *this)
this->private = conf;
if (conf->ios_dump_interval > 0) {
- pthread_create (&conf->dump_thread, NULL,
- (void *) &_ios_dump_thread, this);
+ gf_thread_create (&conf->dump_thread, NULL,
+ (void *) &_ios_dump_thread, this, "iosdump");
}
ret = 0;
out:
diff --git a/xlators/experimental/fdl/src/fdl-tmpl.c b/xlators/experimental/fdl/src/fdl-tmpl.c
index a92f667..145dad7 100644
--- a/xlators/experimental/fdl/src/fdl-tmpl.c
+++ b/xlators/experimental/fdl/src/fdl-tmpl.c
@@ -454,7 +454,8 @@ fdl_init (xlator_t *this)
* exception.
*/
- if (pthread_create(&priv->worker,NULL,fdl_worker,this) != 0) {
+ if (gf_thread_create (&priv->worker, NULL, fdl_worker, this,
+ "fdlwrker") != 0) {
gf_log (this->name, GF_LOG_ERROR,
"failed to start fdl_worker");
goto err;
diff --git a/xlators/experimental/jbr-server/src/jbr.c b/xlators/experimental/jbr-server/src/jbr.c
index 3261319..151ba57 100644
--- a/xlators/experimental/jbr-server/src/jbr.c
+++ b/xlators/experimental/jbr-server/src/jbr.c
@@ -1678,8 +1678,8 @@ jbr_init (xlator_t *this)
priv->leader = priv->config_leader;
priv->child_up = _gf_false;
- if (pthread_create(&kid, NULL, jbr_flush_thread,
- this) != 0) {
+ if (gf_thread_create (&kid, NULL, jbr_flush_thread, this,
+ "jbrflush") != 0) {
gf_msg (this->name, GF_LOG_ERROR, 0, J_MSG_SYS_CALL_FAILURE,
"could not start flush thread");
/* TBD: treat this as a fatal error? */
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;
}
diff --git a/xlators/mgmt/glusterd/src/glusterd-hooks.c b/xlators/mgmt/glusterd/src/glusterd-hooks.c
index 77efa6c..7519ca2 100644
--- a/xlators/mgmt/glusterd/src/glusterd-hooks.c
+++ b/xlators/mgmt/glusterd/src/glusterd-hooks.c
@@ -585,8 +585,8 @@ glusterd_hooks_spawn_worker (xlator_t *this)
conf = this->private;
conf->hooks_priv = hooks_priv;
- ret = pthread_create (&hooks_priv->worker, NULL, hooks_worker,
- (void *)this);
+ ret = gf_thread_create (&hooks_priv->worker, NULL, hooks_worker,
+ (void *)this, "gdhooks");
if (ret)
gf_msg (this->name, GF_LOG_CRITICAL, errno,
GD_MSG_SPAWN_THREADS_FAIL, "Failed to spawn post "
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index a394b62..f9df358 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -4103,7 +4103,7 @@ fuse_init (xlator_t *this, fuse_in_header_t *finh, void *msg)
/* Used for 'reverse invalidation of inode' */
if (fini->minor >= 12) {
ret = gf_thread_create (&messenger, NULL, notify_kernel_loop,
- this);
+ this, "fusenoti");
if (ret != 0) {
gf_log ("glusterfs-fuse", GF_LOG_ERROR,
"failed to start messenger daemon (%s)",
@@ -5309,7 +5309,8 @@ notify (xlator_t *this, int32_t event, void *data, ...)
if (start_thread) {
ret = gf_thread_create (&private->fuse_thread, NULL,
- fuse_thread_proc, this);
+ fuse_thread_proc, this,
+ "fuseproc");
if (ret != 0) {
gf_log (this->name, GF_LOG_DEBUG,
"pthread_create() failed (%s)",
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index 2eaaea5..a05c08c 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -4033,8 +4033,9 @@ mnt3svc_init (xlator_t *nfsx)
}
mstate->stop_refresh = _gf_false; /* Allow thread to run */
- pthread_create (&mstate->auth_refresh_thread, NULL,
- _mnt3_auth_param_refresh_thread, mstate);
+ gf_thread_create (&mstate->auth_refresh_thread, NULL,
+ _mnt3_auth_param_refresh_thread, mstate,
+ "nfsauth");
} else
gf_msg (GF_MNT, GF_LOG_INFO, 0, NFS_MSG_EXP_AUTH_DISABLED,
"Exports auth has been disabled!");
@@ -4083,7 +4084,8 @@ mnt3svc_init (xlator_t *nfsx)
}
if (nfs->mount_udp) {
- pthread_create (&udp_thread, NULL, mount3udp_thread, nfsx);
+ gf_thread_create (&udp_thread, NULL, mount3udp_thread, nfsx,
+ "nfsudp");
}
return &mnt3prog;
err:
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c
index c2d6543..04ec79f 100644
--- a/xlators/nfs/server/src/nlm4.c
+++ b/xlators/nfs/server/src/nlm4.c
@@ -1402,7 +1402,8 @@ nlm4svc_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
stat = nlm4_granted;
if (cs->monitor && !nlm_monitor (caller_name)) {
/* FIXME: handle nsm_monitor failure */
- pthread_create (&thr, NULL, nsm_monitor, (void*)caller_name);
+ gf_thread_create (&thr, NULL, nsm_monitor,
+ (void *)caller_name, "nlmmon");
}
}
@@ -2708,7 +2709,7 @@ nlm4svc_init(xlator_t *nfsx)
}
- pthread_create (&thr, NULL, nsm_thread, (void*)NULL);
+ gf_thread_create (&thr, NULL, nsm_thread, (void *)NULL, "nfsnsm");
timeout.tv_sec = nlm_grace_period;
timeout.tv_nsec = 0;
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 6e2d4c9..7c020e2 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -788,6 +788,7 @@ __iot_workers_scale (iot_conf_t *conf)
pthread_t thread;
int ret = 0;
int i = 0;
+ char thread_name[GF_THREAD_NAMEMAX] = {0,};
for (i = 0; i < IOT_PRI_MAX; i++)
scale += min (conf->queue_sizes[i], conf->ac_iot_limit[i]);
@@ -805,7 +806,10 @@ __iot_workers_scale (iot_conf_t *conf)
while (diff) {
diff --;
- ret = gf_thread_create (&thread, &conf->w_attr, iot_worker, conf);
+ snprintf (thread_name, sizeof(thread_name),
+ "%s%d", "iotwr", conf->curr_count);
+ ret = gf_thread_create (&thread, &conf->w_attr, iot_worker,
+ conf, thread_name);
if (ret == 0) {
conf->curr_count++;
gf_msg_debug (conf->this->name, 0,
diff --git a/xlators/storage/bd/src/bd-aio.c b/xlators/storage/bd/src/bd-aio.c
index 191d23d..c22b905 100644
--- a/xlators/storage/bd/src/bd-aio.c
+++ b/xlators/storage/bd/src/bd-aio.c
@@ -442,8 +442,8 @@ bd_aio_init (xlator_t *this)
goto out;
}
- ret = pthread_create (&priv->aiothread, NULL,
- bd_aio_thread, this);
+ ret = gf_thread_create (&priv->aiothread, NULL,
+ bd_aio_thread, this, "bdaio");
if (ret != 0) {
io_destroy (priv->ctxp);
goto out;
diff --git a/xlators/storage/posix/src/posix-aio.c b/xlators/storage/posix/src/posix-aio.c
index d8ef5f7b..b5ac1b9 100644
--- a/xlators/storage/posix/src/posix-aio.c
+++ b/xlators/storage/posix/src/posix-aio.c
@@ -485,7 +485,7 @@ posix_aio_init (xlator_t *this)
}
ret = gf_thread_create (&priv->aiothread, NULL,
- posix_aio_thread, this);
+ posix_aio_thread, this, "posixaio");
if (ret != 0) {
io_destroy (priv->ctxp);
goto out;
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 53c8a86..1047c2d 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -1438,7 +1438,8 @@ posix_spawn_janitor_thread (xlator_t *this)
{
if (!priv->janitor_present) {
ret = gf_thread_create (&priv->janitor, NULL,
- posix_janitor_thread_proc, this);
+ posix_janitor_thread_proc,
+ this, "posixjan");
if (ret < 0) {
gf_msg (this->name, GF_LOG_ERROR, errno,
@@ -1942,7 +1943,8 @@ posix_spawn_health_check_thread (xlator_t *xl)
goto unlock;
ret = gf_thread_create (&priv->health_check, NULL,
- posix_health_check_thread_proc, xl);
+ posix_health_check_thread_proc,
+ xl, "posixhc");
if (ret < 0) {
priv->health_check_interval = 0;
priv->health_check_active = _gf_false;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index e3fa184..e8ef510 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -7629,7 +7629,8 @@ init (xlator_t *this)
pthread_cond_init (&_private->fsync_cond, NULL);
INIT_LIST_HEAD (&_private->fsyncs);
- ret = gf_thread_create (&_private->fsyncer, NULL, posix_fsyncer, this);
+ ret = gf_thread_create (&_private->fsyncer, NULL, posix_fsyncer, this,
+ "posixfsy");
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, errno,
P_MSG_FSYNCER_THREAD_CREATE_FAILED,