Blob Blame History Raw
From 59ce7264c0bb66af1726d7fb60114c865a5225d6 Mon Sep 17 00:00:00 2001
From: moagrawa <moagrawa@redhat.com>
Date: Wed, 16 Nov 2016 12:01:13 +0530
Subject: [PATCH 164/206] glusterfsd: Continuous errors are getting in mount
 logs while glusterd is down

Problem: when glusterd is down, getting the continuous mgmt_rpc_notify errors
         messages in the volume mount log for every 3 seconds,it will consume
         disk space.

Solution: To reduce the frequency of error messages use GF_LOG_OCCASIONALLY.

> BUG: 1388877
> Change-Id: I6cf24c6ddd9ab380afd058bc0ecd556d664332b1
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
> Reviewed-on: http://review.gluster.org/15732
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
> (cherry picked from commit 7874ed245bcc80658547992205f8396f4dd3c76a)

BUG: 1380655
Change-Id: I5f30c75e679c09897dd4570bf8377bde5680496b
Signed-off-by: moagrawa <moagrawa@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/90289
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 glusterfsd/src/glusterfsd-mgmt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 2a090eb..38fb5b2 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1909,6 +1909,8 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
         rpc_transport_t  *rpc_trans = NULL;
         int              need_term = 0;
         int              emval = 0;
+        static           int log_ctr1;
+        static           int log_ctr2;
         struct dnscache6 *dnscache = NULL;
 
         this = mydata;
@@ -1917,7 +1919,7 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
 
         switch (event) {
         case RPC_CLNT_DISCONNECT:
-                gf_log ("glusterfsd-mgmt", GF_LOG_ERROR,
+                GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt", GF_LOG_ERROR,
                         "failed to connect with remote-host: %s (%s)",
                         ctx->cmd_args.volfile_server, strerror (errno));
                 if (!rpc->disabled) {
@@ -1935,8 +1937,9 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
                         if (!ctx->active)
                                 need_term = 1;
                         emval = ENOTCONN;
-                        gf_log("glusterfsd-mgmt", GF_LOG_INFO,
-                               "Exhausted all volfile servers");
+                        GF_LOG_OCCASIONALLY (log_ctr2, "glusterfsd-mgmt",
+                                             GF_LOG_INFO,
+                                             "Exhausted all volfile servers");
                         break;
                 }
                 server = list_entry (server->list.next, typeof(*server), list);
-- 
2.9.3