summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2014-09-05 14:55:01 +0530
committerVijay Bellur <vbellur@redhat.com>2014-09-26 03:20:07 -0700
commit04edacc5a0cc0a4c8c6bf5188a5ca4afd2fa4965 (patch)
treea427e651704510cb1af73ed83e28ce6ac22defbd /libglusterfs
parent61a7256f977dea586ad62741592f867906a63097 (diff)
synctask: add backtrace per waiting task
The backtrace is 'saved' in a per-task buffer. This would come handy while debugging code using synctasks. Change-Id: I732b275f6d15b31f31361f5ecf2ba47cacde9b54 BUG: 1145093 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/8795 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop.c4
-rw-r--r--libglusterfs/src/syncop.h1
2 files changed, 4 insertions, 1 deletions
diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c
index cc25cd58815..3e176cffc17 100644
--- a/libglusterfs/src/syncop.c
+++ b/libglusterfs/src/syncop.c
@@ -291,8 +291,10 @@ synctask_yield (struct synctask *task)
task->proc->sched.uc_flags &= ~_UC_TLSBASE;
#endif
- if (task->state != SYNCTASK_DONE)
+ if (task->state != SYNCTASK_DONE) {
task->state = SYNCTASK_SUSPEND;
+ (void) gf_backtrace_save (task->btbuf);
+ }
if (swapcontext (&task->ctx, &task->proc->sched) < 0) {
gf_log ("syncop", GF_LOG_ERROR,
"swapcontext failed (%s)", strerror (errno));
diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h
index 41b2ef44942..9e0120a80cc 100644
--- a/libglusterfs/src/syncop.h
+++ b/libglusterfs/src/syncop.h
@@ -79,6 +79,7 @@ struct synctask {
int done;
struct list_head waitq; /* can wait only "once" at a time */
+ char btbuf[GF_BACKTRACE_LEN];
};