e7a346
From 56fb13d05cb4465c14cc231bab1296a48c33c57d Mon Sep 17 00:00:00 2001
e7a346
From: Mohit Agrawal <moagrawa@redhat.com>
e7a346
Date: Tue, 6 Nov 2018 09:06:34 +0530
e7a346
Subject: [PATCH 419/444] glusterfs: During reconfigure set log-level per
e7a346
 xlator level
e7a346
e7a346
Problem: In brick_mux environment, while a user has enabled brick-log-level
e7a346
         for anyone volume, it automatically enables for other volumes
e7a346
         also those are attached with same brick.
e7a346
e7a346
Solution: A log-level option is automatically enabled for other volumes
e7a346
          because log-level saved in glusterfsd_ctx and ctx is common for
e7a346
          volumes those are attached with same brick. To resolve it
e7a346
          set log level for all children xlator's at the time of the graph
e7a346
          reconfigure at io-stat xlator.
e7a346
e7a346
> Change-Id: Id9a6efa05d286e0bea2d47f49292d084e7bb2fcf
e7a346
> fixes: bz#1640495
e7a346
> (Reviwed on upstream link https://review.gluster.org/#/c/glusterfs/+/20488/)
e7a346
> (Cherry pick from commit c34e4161f3cb6539ec83a9020f3d27eb4759a975)
e7a346
e7a346
Change-Id: I1dd57c52997f16e8a05f982c6c05bb4f758e8bd3
e7a346
BUG: 1598407
e7a346
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/155021
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 xlators/debug/io-stats/src/io-stats.c | 32 +++++++++++++++++++++++++++++++-
e7a346
 1 file changed, 31 insertions(+), 1 deletion(-)
e7a346
e7a346
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
e7a346
index 0f71334..aade097 100644
e7a346
--- a/xlators/debug/io-stats/src/io-stats.c
e7a346
+++ b/xlators/debug/io-stats/src/io-stats.c
e7a346
@@ -3812,6 +3812,35 @@ ios_set_log_format_code (struct ios_conf *conf)
e7a346
                 conf->dump_format = IOS_DUMP_TYPE_SAMPLES;
e7a346
 }
e7a346
 
e7a346
+void
e7a346
+xlator_set_loglevel(xlator_t *this, int log_level)
e7a346
+{
e7a346
+    glusterfs_ctx_t *ctx = NULL;
e7a346
+    glusterfs_graph_t *active = NULL;
e7a346
+    xlator_t *top = NULL;
e7a346
+    xlator_t *trav = this;
e7a346
+
e7a346
+    ctx = this->ctx;
e7a346
+    GF_ASSERT(ctx);
e7a346
+    active = ctx->active;
e7a346
+    top = active->first;
e7a346
+
e7a346
+    if (strcmp(top->type, "protocol/server") || (log_level == -1))
e7a346
+        return;
e7a346
+
e7a346
+    /* Set log-level for server xlator */
e7a346
+    top->loglevel = log_level;
e7a346
+
e7a346
+    /* Set log-level for parent xlator */
e7a346
+    if (this->parents)
e7a346
+        this->parents->xlator->loglevel = log_level;
e7a346
+
e7a346
+    while (trav) {
e7a346
+        trav->loglevel = log_level;
e7a346
+        trav = trav->next;
e7a346
+    }
e7a346
+}
e7a346
+
e7a346
 int
e7a346
 reconfigure (xlator_t *this, dict_t *options)
e7a346
 {
e7a346
@@ -3867,7 +3896,8 @@ reconfigure (xlator_t *this, dict_t *options)
e7a346
         GF_OPTION_RECONF ("log-level", log_str, options, str, out);
e7a346
         if (log_str) {
e7a346
                 log_level = glusterd_check_log_level (log_str);
e7a346
-                gf_log_set_loglevel (log_level);
e7a346
+                /* Set loglevel for all children and server xlators */
e7a346
+                xlator_set_loglevel(this, log_level);
e7a346
         }
e7a346
 
e7a346
         GF_OPTION_RECONF ("logger", logger_str, options, str, out);
e7a346
-- 
e7a346
1.8.3.1
e7a346