summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-08-09 18:25:31 +0530
committerVijay Bellur <vbellur@redhat.com>2012-08-11 23:58:31 -0700
commite427d39d629b8f89c25ac7f7a9d1eeca25b9579a (patch)
tree5615606cc09fe00cbaf4deb26054ea290ea6a383
parent92d722fdbeb3ce7316d8bf3a40ae2ac27e06b806 (diff)
performance/read-ahead: use pthread_mutex_trylock to hold mutex in statedumps
Change-Id: I4de64915a9c6a46e126ef4a5b987e49de558f827 BUG: 843796 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3801 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/performance/read-ahead/src/read-ahead.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index 61a07d0..fe318a1 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -949,6 +949,7 @@ ra_priv_dump (xlator_t *this)
ra_conf_t *conf = NULL;
int ret = -1;
char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
+ gf_boolean_t add_section = _gf_false;
if (!this) {
goto out;
@@ -960,26 +961,32 @@ ra_priv_dump (xlator_t *this)
goto out;
}
- ret = pthread_mutex_trylock (&conf->conf_lock);
- if (ret) {
- gf_log (this->name, GF_LOG_WARNING, "Unable to lock client %s "
- "(%s)", this->name, strerror (ret));
- ret = -1;
- goto out;
- }
-
gf_proc_dump_build_key (key_prefix, "xlator.performance.read-ahead",
"priv");
gf_proc_dump_add_section (key_prefix);
- gf_proc_dump_write ("page_size", "%d", conf->page_size);
- gf_proc_dump_write ("page_count", "%d", conf->page_count);
- gf_proc_dump_write ("force_atime_update", "%d", conf->force_atime_update);
+ add_section = _gf_true;
+ ret = pthread_mutex_trylock (&conf->conf_lock);
+ if (ret)
+ goto out;
+ {
+ gf_proc_dump_write ("page_size", "%d", conf->page_size);
+ gf_proc_dump_write ("page_count", "%d", conf->page_count);
+ gf_proc_dump_write ("force_atime_update", "%d",
+ conf->force_atime_update);
+ }
pthread_mutex_unlock (&conf->conf_lock);
ret = 0;
out:
+ if (ret && conf) {
+ if (add_section == _gf_false)
+ gf_proc_dump_add_section (key_prefix);
+
+ gf_proc_dump_write ("Unable to dump priv",
+ "(Lock acquisition failed) %s", this->name);
+ }
return ret;
}