From 951a416532b202b58629c1536131374cb99ee50e Mon Sep 17 00:00:00 2001 From: "Fabio M. Di Nitto" Date: Thu, 18 Jun 2009 18:14:00 +0000 Subject: [PATCH] flight recorder: enable temporary 0 buffer size protection The flight recoder doesn't handle a 0 byte allocation properly and it would fail miserably by allocating a single PAGE_SIZE to handle the logging. That means an enormous performance hit because of the constant wrapping around the buffer. If any requested buffer is < 64000 bytes, then force to at least 64000. In future we will be able to handle small buffers properly, but for now enable a simple workaround to protect us and the user. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2256 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/logsys.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/exec/logsys.c b/exec/logsys.c index 613a2ee2..2c529fcf 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -1057,6 +1057,17 @@ int _logsys_rec_init (unsigned int fltsize) */ size_t flt_real_size; + /* + * XXX: kill me for 1.1 because I am a dirty hack + * temporary workaround that will be replaced by supporting + * 0 byte size flight recorder buffer. + * 0 byte size buffer will enable direct printing to logs + * without flight recoder. + */ + if (fltsize < 64000) { + fltsize = 64000; + } + flt_real_size = ROUNDUP( (fltsize + (2 * sizeof (unsigned int))), sysconf(_SC_PAGESIZE));