diff options
author | Pavan Sondur <pavan@gluster.com> | 2009-10-28 17:03:37 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-10-29 00:52:45 -0700 |
commit | 03c6fe7f7e51d391beb370d04964af1de9728d28 (patch) | |
tree | 4912e8940674e692df8c22872eaee3d93b2bf1c0 /xlators/features/locks/src/posix.c | |
parent | 9a62a3747cfcef2db3bc0b630a92f24d9436eeca (diff) |
Trace locks in and out with an option in normal log mode.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 306 (Enhance locks to aid debugging)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=306
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r-- | xlators/features/locks/src/posix.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 3b011317c..f23716251 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -281,6 +281,8 @@ pl_flush (call_frame_t *frame, xlator_t *this, return 0; } + pl_trace_flush (this, frame, fd); + pthread_mutex_lock (&pl_inode->mutex); { __delete_locks_of_owner (pl_inode, frame->root->trans, @@ -643,6 +645,8 @@ pl_lk (call_frame_t *frame, xlator_t *this, goto unwind; } + pl_trace_in (this, frame, fd, NULL, cmd, flock); + switch (cmd) { #if F_GETLK != F_GETLK64 @@ -675,9 +679,10 @@ pl_lk (call_frame_t *frame, xlator_t *this, can_block); if (ret == -1) { - if (can_block) + if (can_block) { + pl_trace_block (this, frame, fd, NULL, cmd, flock); goto out; - + } gf_log (this->name, GF_LOG_DEBUG, "returning EAGAIN"); op_ret = -1; op_errno = EAGAIN; @@ -686,6 +691,7 @@ pl_lk (call_frame_t *frame, xlator_t *this, } unwind: + pl_trace_out (this, frame, fd, NULL, cmd, flock, op_ret, op_errno); pl_update_refkeeper (this, fd->inode); STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, flock); out: @@ -1020,6 +1026,7 @@ init (xlator_t *this) posix_locks_private_t *priv = NULL; xlator_list_t *trav = NULL; data_t *mandatory = NULL; + data_t *trace = NULL; if (!this->children || this->children->next) { gf_log (this->name, GF_LOG_CRITICAL, @@ -1056,6 +1063,16 @@ init (xlator_t *this) } } + trace = dict_get (this->options, "trace"); + if (trace) { + if (gf_string2boolean (trace->data, + &priv->trace) == -1) { + gf_log (this->name, GF_LOG_ERROR, + "'trace' takes on only boolean values."); + return -1; + } + } + this->private = priv; return 0; } @@ -1124,5 +1141,8 @@ struct volume_options options[] = { { .key = { "mandatory-locks", "mandatory" }, .type = GF_OPTION_TYPE_BOOL }, + { .key = { "trace" }, + .type = GF_OPTION_TYPE_BOOL + }, { .key = {NULL} }, }; |