diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-08-09 18:19:09 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-08-11 23:57:02 -0700 |
commit | 92d722fdbeb3ce7316d8bf3a40ae2ac27e06b806 (patch) | |
tree | 9e71b14694997403a68c56294c369bb67aa36207 /xlators/performance | |
parent | c79690c4cb503a6e6b52998038fd85cdfcf0f7be (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: Ic77d96bc52f2a2a32629c0ae20bba797317e0a81
BUG: 843789
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3800
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/quick-read/src/quick-read.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c index fed57601577..0e09a871aa1 100644 --- a/xlators/performance/quick-read/src/quick-read.c +++ b/xlators/performance/quick-read/src/quick-read.c @@ -3436,6 +3436,7 @@ qr_inodectx_dump (xlator_t *this, inode_t *inode) char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, }; char buf[256] = {0, }; struct tm *tm = NULL; + ret = inode_ctx_get (inode, this, &value); if (ret != 0) { goto out; @@ -3475,6 +3476,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 section_added = _gf_false; ret = fd_ctx_get (fd, this, &value); if (ret != 0) { @@ -3489,13 +3491,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); + section_added = _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 ? @@ -3523,6 +3528,15 @@ qr_fdctx_dump (xlator_t *this, fd_t *fd) ret = 0; out: + if (ret && fdctx) { + if (_gf_false == section_added) + gf_proc_dump_add_section (key_prefix); + + gf_proc_dump_write ("Unable to dump the state of fdctx", + "(Lock acquisition failed) fd: %p, " + "gfid: %s", fd, + uuid_utoa (fd->inode->gfid)); + } return ret; } |