From fbaea55d731ea9891c1c6ae08dea6b7765e7ad11 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Sat, 17 Oct 2009 00:58:01 +0000 Subject: locks: trace support for inodelk Signed-off-by: Anand V. Avati BUG: 306 (Enhance locks to aid debugging) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=306 --- xlators/features/locks/src/common.c | 20 ++++++++++---------- xlators/features/locks/src/common.h | 12 ++++++------ xlators/features/locks/src/internal.c | 16 ++++++++++++++-- xlators/features/locks/src/posix.c | 7 ++++--- 4 files changed, 34 insertions(+), 21 deletions(-) (limited to 'xlators/features/locks') diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index 105422271..34576953a 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -532,7 +532,7 @@ grant_blocked_locks (xlator_t *this, pl_inode_t *pl_inode, gf_lk_domain_t dom) list_for_each_entry_safe (lock, tmp, &granted_list, list) { list_del_init (&lock->list); - pl_trace_out (this, lock->frame, NULL, F_SETLKW, + pl_trace_out (this, lock->frame, NULL, NULL, F_SETLKW, &lock->user_flock, 0, 0); STACK_UNWIND (lock->frame, 0, 0, &lock->user_flock); @@ -709,8 +709,8 @@ pl_print_lock (char *str, int size, int cmd, struct flock *flock) void -pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock) +pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock) { posix_locks_private_t *priv = NULL; char pl_locker[256]; @@ -723,7 +723,7 @@ pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, return; pl_print_locker (pl_locker, 256, this, frame); - pl_print_lockee (pl_lockee, 256, fd, NULL); + pl_print_lockee (pl_lockee, 256, fd, loc); pl_print_lock (pl_lock, 256, cmd, flock); gf_log (this->name, GF_LOG_NORMAL, @@ -754,8 +754,8 @@ pl_print_verdict (char *str, int size, int op_ret, int op_errno) void -pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock, int op_ret, int op_errno) +pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock, int op_ret, int op_errno) { posix_locks_private_t *priv = NULL; char pl_locker[256]; @@ -769,7 +769,7 @@ pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, return; pl_print_locker (pl_locker, 256, this, frame); - pl_print_lockee (pl_lockee, 256, fd, NULL); + pl_print_lockee (pl_lockee, 256, fd, loc); pl_print_lock (pl_lock, 256, cmd, flock); pl_print_verdict (verdict, 32, op_ret, op_errno); @@ -780,8 +780,8 @@ pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, void -pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock) +pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock) { posix_locks_private_t *priv = NULL; char pl_locker[256]; @@ -794,7 +794,7 @@ pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, return; pl_print_locker (pl_locker, 256, this, frame); - pl_print_lockee (pl_lockee, 256, fd, NULL); + pl_print_lockee (pl_lockee, 256, fd, loc); pl_print_lock (pl_lock, 256, cmd, flock); gf_log (this->name, GF_LOG_NORMAL, diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h index 89d8701bf..cc53482c4 100644 --- a/xlators/features/locks/src/common.h +++ b/xlators/features/locks/src/common.h @@ -51,14 +51,14 @@ void __destroy_lock (posix_lock_t *); void pl_update_refkeeper (xlator_t *this, inode_t *inode); -void pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock); +void pl_trace_in (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock); -void pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock, int op_ret, int op_errno); +void pl_trace_out (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock, int op_ret, int op_errno); -void pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, int cmd, - struct flock *flock); +void pl_trace_block (xlator_t *this, call_frame_t *frame, fd_t *fd, loc_t *loc, + int cmd, struct flock *flock); void pl_trace_flush (xlator_t *this, call_frame_t *frame, fd_t *fd); diff --git a/xlators/features/locks/src/internal.c b/xlators/features/locks/src/internal.c index 34087da6e..116902fa8 100644 --- a/xlators/features/locks/src/internal.c +++ b/xlators/features/locks/src/internal.c @@ -134,6 +134,8 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, goto unwind; } + pl_trace_in (this, frame, NULL, loc, cmd, flock); + if (client_pid == 0) { /* special case: this means release all locks @@ -169,8 +171,11 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, can_block, GF_LOCK_INTERNAL); if (ret == -1) { - if (can_block) + if (can_block) { + pl_trace_block (this, frame, NULL, loc, + cmd, flock); goto out; + } gf_log (this->name, GF_LOG_TRACE, "returning EAGAIN"); op_errno = EAGAIN; @@ -192,6 +197,7 @@ pl_inodelk (call_frame_t *frame, xlator_t *this, unwind: pl_update_refkeeper (this, loc->inode); + pl_trace_out (this, frame, NULL, loc, cmd, flock, op_ret, op_errno); STACK_UNWIND (frame, op_ret, op_errno); out: return 0; @@ -236,6 +242,8 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, goto unwind; } + pl_trace_in (this, frame, fd, NULL, cmd, flock); + if (client_pid == 0) { /* special case: this means release all locks @@ -272,8 +280,11 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, can_block, GF_LOCK_INTERNAL); 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_TRACE, "Returning EAGAIN"); op_errno = EAGAIN; @@ -295,6 +306,7 @@ pl_finodelk (call_frame_t *frame, xlator_t *this, unwind: pl_update_refkeeper (this, fd->inode); + pl_trace_out (this, frame, fd, NULL, cmd, flock, op_ret, op_errno); STACK_UNWIND (frame, op_ret, op_errno); out: return 0; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 74740151a..e2ff664ca 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -646,7 +646,7 @@ pl_lk (call_frame_t *frame, xlator_t *this, goto unwind; } - pl_trace_in (this, frame, fd, cmd, flock); + pl_trace_in (this, frame, fd, NULL, cmd, flock); switch (cmd) { @@ -681,7 +681,8 @@ pl_lk (call_frame_t *frame, xlator_t *this, if (ret == -1) { if (can_block) { - pl_trace_block (this, frame, fd, cmd, flock); + pl_trace_block (this, frame, fd, NULL, + cmd, flock); goto out; } @@ -693,7 +694,7 @@ pl_lk (call_frame_t *frame, xlator_t *this, } unwind: - pl_trace_out (this, frame, fd, cmd, flock, op_ret, op_errno); + pl_trace_out (this, frame, fd, NULL, cmd, flock, op_ret, op_errno); pl_update_refkeeper (this, fd->inode); STACK_UNWIND (frame, op_ret, op_errno, flock); -- cgit