From fd8b19af1713f2800af743d851706b96ca15d9ec Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 14 Nov 2012 19:25:14 +0530 Subject: debug/trace: save the recent fops received in the event-history * Make use of event-history in debug/trace xlator to dump the recent fops, when statedump is given. trace xlator saves the fop it received along with the time in the event-history and upon statedump signal, dumps its history. The size of the event-history can be given as a xlator option. * Make changes in trace to take logging into log-file or logging to history as an option. By default both are off. Change-Id: I12baee5805c6efb55735cead4e2093fb94d7a6a0 BUG: 797171 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.org/4088 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/logging.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libglusterfs/src/logging.c') diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index d8b9a124b..65613f985 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -598,6 +598,10 @@ _gf_log_eh (const char *function, const char *fmt, ...) va_end (ap); msg = GF_MALLOC (strlen (str1) + strlen (str2) + 1, gf_common_mt_char); + if (!msg) { + ret = -1; + goto out; + } strcpy (msg, str1); strcat (msg, str2); @@ -605,8 +609,7 @@ _gf_log_eh (const char *function, const char *fmt, ...) ret = eh_save_history (this->history, msg); out: - if (str1) - GF_FREE (str1); + GF_FREE (str1); /* Use FREE instead of GF_FREE since str2 was allocated by vasprintf */ if (str2) -- cgit