diff options
| author | Raghavendra Bhat <raghavendra@redhat.com> | 2012-08-13 19:16:43 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2012-08-15 22:51:59 -0700 | 
| commit | cb7647f67390920fa2aa25fd0af7c84787c08ed0 (patch) | |
| tree | 16862fad618b2be9644f32bd33d6d81a924536fc | |
| parent | 41d3605fab2f0ce8c8b4c5d976fc1a013c823e3d (diff) | |
performance/write-behind: use pthread_mutex_trylock to hold mutex in statedumps
Change-Id: I24c83b1b5e83ef3e38a019043c7fbca13b19ff43
BUG: 841543
Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Reviewed-on: http://review.gluster.com/3815
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
| -rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 18 | 
1 files changed, 15 insertions, 3 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index a743039d9ab..f392d6fe2e0 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -2784,6 +2784,7 @@ wb_file_dump (xlator_t *this, fd_t *fd)          int32_t    ret                             = -1;          char      *path                            = NULL;          char       key_prefix[GF_DUMP_MAX_BUF_LEN] = {0, }; +        gf_boolean_t section_added = _gf_true;          if ((fd == NULL) || (this == NULL)) {                  ret = 0; @@ -2806,6 +2807,7 @@ wb_file_dump (xlator_t *this, fd_t *fd)                                  "file");          gf_proc_dump_add_section (key_prefix); +        section_added = _gf_true;          __inode_path (fd->inode, NULL, &path);          if (path != NULL) { @@ -2834,7 +2836,10 @@ wb_file_dump (xlator_t *this, fd_t *fd)          gf_proc_dump_write ("op_errno", "%d", file->op_errno); -        LOCK (&file->lock); +        ret = TRY_LOCK (&file->lock); +        if (ret) +                goto out; +        else          {                  if (!list_empty (&file->request)) {                          __wb_dump_requests (&file->request, key_prefix, 0); @@ -2844,11 +2849,18 @@ wb_file_dump (xlator_t *this, fd_t *fd)                          __wb_dump_requests (&file->passive_requests, key_prefix,                                              1);                  } -        } +          UNLOCK (&file->lock); +        } -        ret = 0;  out: +        if (ret && file) { +                if (section_added == _gf_false) +                        gf_proc_dump_add_section (key_prefix); +                gf_proc_dump_write ("Unable to dump the fd context", +                                    "(Lock acquisition failed) fd:%p, gfid:%s", +                                    fd, uuid_utoa (fd->inode->gfid)); +        }          return ret;  }  | 
