summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2012-08-01 16:28:13 +0530
committerAnand Avati <avati@redhat.com>2012-08-02 13:28:52 -0700
commit36827add0f55d674768ff9c90c5fbb636ae99054 (patch)
treec641888285cff1119fbbead37e194526374f7098 /xlators/performance
parentc8ed0096d53de3e39feee5b857b6b657118bc0a1 (diff)
performance/quick-read: use pthread_mutex_trylock to hold mutex in statedumps
Do not use pthread_mutex_lock and gf_log functions while dumping information to statedump, to avoid deadlocks. Change-Id: I0d30b04ae322f131b7a42d277ebd4385e83769e6 BUG: 843789 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3764 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/quick-read/src/quick-read.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 349ea778902..867900b902c 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -3431,6 +3431,7 @@ qr_inodectx_dump (xlator_t *this, inode_t *inode)
int32_t ret = -1;
char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
char buf[256] = {0, };
+
ret = inode_ctx_get (inode, this, &value);
if (ret != 0) {
goto out;
@@ -3470,6 +3471,7 @@ qr_fdctx_dump (xlator_t *this, fd_t *fd)
char key[GF_DUMP_MAX_BUF_LEN] = {0, };
char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, };
call_stub_t *stub = NULL;
+ gf_boolean_t add_section = _gf_false;
ret = fd_ctx_get (fd, this, &value);
if (ret != 0) {
@@ -3484,13 +3486,16 @@ qr_fdctx_dump (xlator_t *this, fd_t *fd)
gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read",
"fdctx");
gf_proc_dump_add_section (key_prefix);
+ add_section = _gf_true;
gf_proc_dump_write ("fd", "%p", fd);
- gf_proc_dump_write ("path", "%s", fdctx->path);
-
- LOCK (&fdctx->lock);
+ ret = TRY_LOCK (&fdctx->lock);
+ if (ret)
+ goto out;
{
+ gf_proc_dump_write ("path", "%s", fdctx->path);
+
gf_proc_dump_write ("opened", "%s", fdctx->opened ? "yes" : "no");
gf_proc_dump_write ("open-in-progress", "%s", fdctx->open_in_transit ?
@@ -3518,6 +3523,14 @@ qr_fdctx_dump (xlator_t *this, fd_t *fd)
ret = 0;
out:
+ if (ret && fdctx) {
+ if (add_section == _gf_false)
+ gf_proc_dump_add_section (key_prefix);
+
+ gf_proc_dump_write ("Unable to dump the state of fdctx",
+ "(Lock acquistion failed) fd: %p, gfid: %s",
+ fd, uuid_utoa (fd->inode->gfid));
+ }
return ret;
}