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>
This commit is contained in:
Mohit Agrawal 2018-10-18 14:06:04 +05:30 committed by Amar Tumballi
parent 1be6703b10
commit c34e4161f3

View File

@ -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);