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