diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-08-01 16:38:34 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-01 14:33:58 -0700 |
commit | a5341ef545b1568cbe33db80f62950e428ede98a (patch) | |
tree | 5dbed694f0a00ba14f2a3eee460f3d0fbfe55e72 /xlators/performance | |
parent | 3bf5cd69c6c8997b089ad9d007c72cfd92c7f44e (diff) |
performance/read-ahead: use pthread_mutex_trylock to hold mutex in statedumps
Change-Id: I4491c96fc7d9879ba9040dcda3700c81d99ba184
BUG: 843796
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3766
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/read-ahead/src/read-ahead.c | 29 |
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 7b23049d371..54949675510 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; } |