diff options
author | Rajesh Amaravathi <rajesh@redhat.com> | 2012-11-15 14:20:39 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-11-24 07:09:40 -0800 |
commit | b6bf52bdcc78c7a803430ebcd7be367fbbf9cc4d (patch) | |
tree | c33bae92512c2c86c30050069ec1937001b37b83 /xlators | |
parent | 419e5835ec183a73560ad65a94fb036495c4f386 (diff) |
nfs: avoid blocking lock calls in statedump code
This change replaces LOCK () with TRY_LOCK () in
nlm statedump code.
Change-Id: I28c558b68854cf08c3a8190a00d6e3d507317628
BUG: 843819
Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com>
Reviewed-on: http://review.gluster.org/4193
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/nlm4.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index 2e02a5836..4ee3596fd 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -2455,7 +2455,8 @@ nlm_priv (xlator_t *this) gf_proc_dump_add_section("nfs.nlm"); - LOCK (&nlm_client_list_lk); + if (TRY_LOCK (&nlm_client_list_lk)) + goto out; list_for_each_entry (client, &nlm_client_list, nlm_clients) { @@ -2478,7 +2479,15 @@ nlm_priv (xlator_t *this) gf_proc_dump_build_key (key, "nlm", "client-count"); gf_proc_dump_write (key, "%d", client_count); - + ret = 0; UNLOCK (&nlm_client_list_lk); + + out: + if (ret) { + gf_proc_dump_build_key (key, "nlm", "statedump_error"); + gf_proc_dump_write (key, "Unable to dump nlm state because " + "nlm_client_list_lk lock couldn't be acquired"); + } + return ret; } |