From c34e4161f3cb6539ec83a9020f3d27eb4759a975 Mon Sep 17 00:00:00 2001 From: Mohit Agrawal Date: Thu, 18 Oct 2018 14:06:04 +0530 Subject: 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 --- xlators/debug/io-stats/src/io-stats.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'xlators') 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); -- cgit