diff options
author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-08-02 16:23:08 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-02 11:42:40 -0700 |
commit | b25eba06d5d50543975d24a0dc0a3a1934faf40b (patch) | |
tree | 73772ccfa91ba507148d8334ec2f00052f5cb645 /xlators/protocol/server | |
parent | 91bf4e5137b56cf52162e30db92df02ef9964b10 (diff) |
protocol/server: use pthread_mutex_trylock while dumping statedumps
Change-Id: Iec6f539ee7d36c25aca3960abc6d2611707617c8
BUG: 843821
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3774
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r-- | xlators/protocol/server/src/server.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 74dbc17e6af..b6519e5955a 100644 --- a/xlators/protocol/server/src/server.c +++ b/xlators/protocol/server/src/server.c @@ -245,6 +245,7 @@ server_fd (xlator_t *this) char key[GF_DUMP_MAX_BUF_LEN]; int i = 1; int ret = -1; + gf_boolean_t section_added = _gf_false; GF_VALIDATE_OR_GOTO ("server", this, out); @@ -256,13 +257,11 @@ server_fd (xlator_t *this) } gf_proc_dump_add_section("xlator.protocol.server.conn"); + section_added = _gf_true; ret = pthread_mutex_trylock (&conf->mutex); - if (ret) { - gf_log("", GF_LOG_WARNING, "Unable to dump fdtable" - " errno: %d", errno); - return -1; - } + if (ret) + goto out; list_for_each_entry (trav, &conf->conns, list) { if (trav->id) { @@ -288,6 +287,13 @@ server_fd (xlator_t *this) ret = 0; out: + if (ret) { + if (section_added == _gf_false) + gf_proc_dump_add_section("xlator.protocol.server.conn"); + gf_proc_dump_write ("Unable to dump the list of connections", + "(Lock acquisition failed) %s", + this?this->name:"server"); + } return ret; } @@ -366,7 +372,12 @@ server_priv (xlator_t *this) if (!conf) return 0; - pthread_mutex_lock (&conf->mutex); + gf_proc_dump_build_key (key, "xlator.protocol.server", "priv"); + gf_proc_dump_add_section (key); + + ret = pthread_mutex_trylock (&conf->mutex); + if (ret != 0) + goto out; { list_for_each_entry (xprt, &conf->xprt_list, list) { total_read += xprt->total_bytes_read; @@ -383,6 +394,11 @@ server_priv (xlator_t *this) ret = 0; out: + if (ret) + gf_proc_dump_write ("Unable to print priv", + "(Lock acquisition failed) %s", + this?this->name:"server"); + return ret; } @@ -457,11 +473,8 @@ server_inode (xlator_t *this) } ret = pthread_mutex_trylock (&conf->mutex); - if (ret) { - gf_log("", GF_LOG_WARNING, "Unable to dump itable" - " errno: %d", errno); - return -1; - } + if (ret) + goto out; list_for_each_entry (trav, &conf->conns, list) { if (trav->bound_xl && trav->bound_xl->itable) { @@ -487,6 +500,11 @@ server_inode (xlator_t *this) ret = 0; out: + if (ret) + gf_proc_dump_write ("Unable to dump the inode table", + "(Lock acquisition failed) %s", + this?this->name:"server"); + return ret; } |