74b1de
From 82d7c8e057b9e22d13ca89f2a75e65a42878b7c3 Mon Sep 17 00:00:00 2001
74b1de
From: Atin Mukherjee <amukherj@redhat.com>
74b1de
Date: Tue, 2 Apr 2019 10:45:15 +0530
74b1de
Subject: [PATCH 092/124] logging: Fix GF_LOG_OCCASSIONALLY API
74b1de
74b1de
GF_LOG_OCCASSIONALLY doesn't log on the first instance rather at every
74b1de
42nd iterations which isn't effective as in some cases we might not have
74b1de
the code flow hitting the same log for as many as 42 times and we'd end
74b1de
up suppressing the log.
74b1de
74b1de
>upstream fix : https://review.gluster.org/#/c/glusterfs/+/22475/
74b1de
>Fixes: bz#1694925
74b1de
>Change-Id: Iee293281d25a652b64df111d59b13de4efce06fa
74b1de
>Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
74b1de
BUG: 1691620
74b1de
Change-Id: Iee293281d25a652b64df111d59b13de4efce06fa
74b1de
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/167822
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74b1de
---
74b1de
 libglusterfs/src/glusterfs/logging.h | 2 +-
74b1de
 1 file changed, 1 insertion(+), 1 deletion(-)
74b1de
74b1de
diff --git a/libglusterfs/src/glusterfs/logging.h b/libglusterfs/src/glusterfs/logging.h
74b1de
index c81e19b..3655b1d 100644
74b1de
--- a/libglusterfs/src/glusterfs/logging.h
74b1de
+++ b/libglusterfs/src/glusterfs/logging.h
74b1de
@@ -300,7 +300,7 @@ _gf_log_eh(const char *function, const char *fmt, ...)
74b1de
 
74b1de
 /* Log once in GF_UNIVERSAL_ANSWER times */
74b1de
 #define GF_LOG_OCCASIONALLY(var, args...)                                      \
74b1de
-    if (!(var++ % GF_UNIVERSAL_ANSWER)) {                                      \
74b1de
+    if (var++ == 0 || !((var - 1) % GF_UNIVERSAL_ANSWER)) {                    \
74b1de
         gf_log(args);                                                          \
74b1de
     }
74b1de
 
74b1de
-- 
74b1de
1.8.3.1
74b1de