summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index b1eb7e435..74740151a 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -286,6 +286,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,
@@ -644,6 +646,8 @@ pl_lk (call_frame_t *frame, xlator_t *this,
goto unwind;
}
+ pl_trace_in (this, frame, fd, cmd, flock);
+
switch (cmd) {
#if F_GETLK != F_GETLK64
@@ -676,8 +680,10 @@ pl_lk (call_frame_t *frame, xlator_t *this,
can_block, GF_LOCK_POSIX);
if (ret == -1) {
- if (can_block)
+ if (can_block) {
+ pl_trace_block (this, frame, fd, cmd, flock);
goto out;
+ }
gf_log (this->name, GF_LOG_DEBUG, "returning EAGAIN");
op_ret = -1;
@@ -687,6 +693,8 @@ pl_lk (call_frame_t *frame, xlator_t *this,
}
unwind:
+ pl_trace_out (this, frame, fd, cmd, flock, op_ret, op_errno);
+
pl_update_refkeeper (this, fd->inode);
STACK_UNWIND (frame, op_ret, op_errno, flock);
out:
@@ -775,6 +783,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,
@@ -811,6 +820,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;
}
@@ -875,5 +894,8 @@ struct volume_options options[] = {
{ .key = { "mandatory-locks", "mandatory" },
.type = GF_OPTION_TYPE_BOOL
},
+ { .key = { "trace" },
+ .type = GF_OPTION_TYPE_BOOL
+ },
{ .key = {NULL} },
};