From 7413b50220779d185efdb1d259c379a119a30a77 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 4 Oct 2012 20:55:30 +0530 Subject: performance/write-behind: use try lock while taking statedumps Change-Id: I690e8bf650d6e6e50899c2e17a79f42789e701eb BUG: 843792 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/4036 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Anand Avati --- xlators/performance/write-behind/src/write-behind.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'xlators/performance/write-behind') diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 53506d948ba..ee533db2012 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -1734,6 +1734,7 @@ wb_inode_dump (xlator_t *this, inode_t *inode) int32_t ret = -1; char *path = NULL; char key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, }; + char uuid_str[64] = {0,}; if ((inode == NULL) || (this == NULL)) { ret = 0; @@ -1769,14 +1770,20 @@ wb_inode_dump (xlator_t *this, inode_t *inode) gf_proc_dump_write ("op_errno", "%d", wb_inode->op_errno); - LOCK (&wb_inode->lock); + ret = TRY_LOCK (&wb_inode->lock); + if (!ret) { if (!list_empty (&wb_inode->all)) { __wb_dump_requests (&wb_inode->all, key_prefix); } + UNLOCK (&wb_inode->lock); } - UNLOCK (&wb_inode->lock); + if (ret && wb_inode) + gf_proc_dump_write ("Unable to dump the inode information", + "(Lock acquisition failed) %p (gfid: %s)", + wb_inode, + uuid_utoa_r (inode->gfid, uuid_str)); ret = 0; out: return ret; -- cgit