summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/logging.c
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2014-09-03 11:03:06 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-09-22 04:08:58 -0700
commit1b53756e50cb9ad5422292d7f4e1e6fe23357222 (patch)
tree30eaf25c1fbc7e359796a86d21897ecd14f4af2a /libglusterfs/src/logging.c
parent0cbfe677f361cf49b182748f4b71ded13f6bc988 (diff)
glusterd: Add last successful glusterd lock backtrace
Also, moved the backtrace fetching logic to a separate function. Modified the backtrace fetching logic able to work under memory pressure conditions. Change-Id: Ie38bea425a085770f41831314aeda95595177ece BUG: 1138503 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/8584 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'libglusterfs/src/logging.c')
-rw-r--r--libglusterfs/src/logging.c27
1 files changed, 4 insertions, 23 deletions
diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c
index 01e34b4c6a7..ab7b96a54d4 100644
--- a/libglusterfs/src/logging.c
+++ b/libglusterfs/src/logging.c
@@ -775,7 +775,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
char *str2 = NULL;
char *msg = NULL;
char timestr[256] = {0,};
- char callstr[4096] = {0,};
+ char *callstr = NULL;
struct timeval tv = {0,};
size_t len = 0;
int ret = 0;
@@ -817,28 +817,9 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function,
else
basename = file;
- do {
- void *array[5];
- char **callingfn = NULL;
- size_t size = 0;
-
- size = backtrace (array, 5);
- if (size)
- callingfn = backtrace_symbols (&array[2], size-2);
- if (!callingfn)
- break;
-
- if (size == 5)
- snprintf (callstr, 4096, "(-->%s (-->%s (-->%s)))",
- callingfn[2], callingfn[1], callingfn[0]);
- if (size == 4)
- snprintf (callstr, 4096, "(-->%s (-->%s))",
- callingfn[1], callingfn[0]);
- if (size == 3)
- snprintf (callstr, 4096, "(-->%s)", callingfn[0]);
-
- free (callingfn);
- } while (0);
+ /*Saving the backtrace to pre-allocated ctx->btbuf
+ * to avoid allocating memory from the heap*/
+ callstr = gf_backtrace_save (NULL);
if (ctx->log.log_control_file_found)
{