From 58f23090fc0af2d93c02da68b06e02d1263df499 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Fri, 5 Sep 2014 14:55:01 +0530 Subject: 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: 1138503 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/8622 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Atin Mukherjee Reviewed-by: Vijay Bellur --- libglusterfs/src/syncop.c | 4 +++- libglusterfs/src/syncop.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'libglusterfs') 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 80b899badb2..31438b17883 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]; }; -- cgit