summaryrefslogtreecommitdiffstats
path: root/xlators/debug
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2018-10-18 14:06:04 +0530
committerAmar Tumballi <amarts@redhat.com>2018-10-24 06:29:35 +0000
commitc34e4161f3cb6539ec83a9020f3d27eb4759a975 (patch)
tree704ff52b40a675e52720cf517f768d5e53854b18 /xlators/debug
parent1be6703b1005bf572cea70f2254d7b5a8ed02351 (diff)
glusterfs: During reconfigure set log-level per xlator level
Problem: In brick_mux environment, while a user has enabled brick-log-level for anyone volume, it automatically enables for other volumes also those are attached with same brick. Solution: A log-level option is automatically enabled for other volumes because log-level saved in glusterfsd_ctx and ctx is common for volumes those are attached with same brick. To resolve it set log level for all children xlator's at the time of the graph reconfigure at io-stat xlator. Change-Id: Id9a6efa05d286e0bea2d47f49292d084e7bb2fcf fixes: bz#1640495 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/debug')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index f2b72369421..3b370f20e50 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3660,6 +3660,35 @@ ios_set_log_format_code(struct ios_conf *conf)
conf->dump_format = IOS_DUMP_TYPE_SAMPLES;
}
+void
+xlator_set_loglevel(xlator_t *this, int log_level)
+{
+ glusterfs_ctx_t *ctx = NULL;
+ glusterfs_graph_t *active = NULL;
+ xlator_t *top = NULL;
+ xlator_t *trav = this;
+
+ ctx = this->ctx;
+ GF_ASSERT(ctx);
+ active = ctx->active;
+ top = active->first;
+
+ if (strcmp(top->type, "protocol/server") || (log_level == -1))
+ return;
+
+ /* Set log-level for server xlator */
+ top->loglevel = log_level;
+
+ /* Set log-level for parent xlator */
+ if (this->parents)
+ this->parents->xlator->loglevel = log_level;
+
+ while (trav) {
+ trav->loglevel = log_level;
+ trav = trav->next;
+ }
+}
+
int
reconfigure(xlator_t *this, dict_t *options)
{
@@ -3726,7 +3755,8 @@ reconfigure(xlator_t *this, dict_t *options)
GF_OPTION_RECONF("log-level", log_str, options, str, out);
if (log_str) {
log_level = glusterd_check_log_level(log_str);
- gf_log_set_loglevel(this->ctx, log_level);
+ /* Set loglevel for all children and server xlators */
+ xlator_set_loglevel(this, log_level);
}
GF_OPTION_RECONF("logger", logger_str, options, str, out);