summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2019-04-02 10:45:15 +0530
committergluster-ant <bugzilla-bot@gluster.org>2019-04-02 10:45:15 +0530
commita8a7a877b4be1625db6cf953efb32f5dc7543040 (patch)
treed1d40b08a1166090720b46c3380ed1c518daa837
parent75c092e28a3759f81228e28fd25a1c3ea81bba37 (diff)
downloadglusterfs-a8a7a877b4be1625db6cf953efb32f5dc7543040.tar.gz
glusterfs-a8a7a877b4be1625db6cf953efb32f5dc7543040.tar.xz
glusterfs-a8a7a877b4be1625db6cf953efb32f5dc7543040.zip
logging: Fix GF_LOG_OCCASSIONALLY API
GF_LOG_OCCASSIONALLY doesn't log on the first instance rather at every 42nd iterations which isn't effective as in some cases we might not have the code flow hitting the same log for as many as 42 times and we'd end up suppressing the log. Fixes: bz#1694925 Change-Id: Iee293281d25a652b64df111d59b13de4efce06fa Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
-rw-r--r--libglusterfs/src/glusterfs/logging.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/glusterfs/logging.h b/libglusterfs/src/glusterfs/logging.h
index c81e19bef3..3655b1d11b 100644
--- a/libglusterfs/src/glusterfs/logging.h
+++ b/libglusterfs/src/glusterfs/logging.h
@@ -300,7 +300,7 @@ _gf_log_eh(const char *function, const char *fmt, ...)
/* Log once in GF_UNIVERSAL_ANSWER times */
#define GF_LOG_OCCASIONALLY(var, args...) \
- if (!(var++ % GF_UNIVERSAL_ANSWER)) { \
+ if (var++ == 0 || !((var - 1) % GF_UNIVERSAL_ANSWER)) { \
gf_log(args); \
}