diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2018-05-16 14:12:21 +0530 |
---|---|---|
committer | Pranith Kumar K <pkarampu@redhat.com> | 2018-05-16 14:57:53 +0530 |
commit | 9ead9a66900b15387b4b7588ff5c1300810d5eba (patch) | |
tree | 3549df31aaee121bfbd471eb57c2900d5344062a /libglusterfs | |
parent | f631ceb79e822bb5c3bbbaa2ad3a28a3f32e4251 (diff) |
statedump: Prevent duplicate statedump for master and active
Csaba found that statedump of fusemount has two instances of
each of the mem-accounting information. On debugging, I realized
that statedump is called for both ctx->master and ctx->active.
Since ctx->active is a sub-graph of ctx->master, there are duplicate
entries. Fixed this part to prevent duplication in this patch.
fixes bz#1578721
BUG: 1578721
Change-Id: I5a63b4f5933d4d720ac010c58e6dee3b27067d42
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/statedump.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c index 412a47b9383..874326f44ce 100644 --- a/libglusterfs/src/statedump.c +++ b/libglusterfs/src/statedump.c @@ -502,44 +502,53 @@ gf_proc_dump_dict_info (glusterfs_ctx_t *ctx) } static void -gf_proc_dump_per_xlator_info (xlator_t *top) +gf_proc_dump_single_xlator_info (xlator_t *trav) { - xlator_t *trav = top; - glusterfs_ctx_t *ctx = top->ctx; + glusterfs_ctx_t *ctx = trav->ctx; char itable_key[1024] = {0,}; - while (trav && !trav->cleanup_starting) { - if (ctx->measure_latency) - gf_proc_dump_latency_info (trav); - gf_proc_dump_xlator_mem_info(trav); + if (trav->cleanup_starting) + return; - if (GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode) && - (trav->itable)) { - snprintf (itable_key, 1024, "%d.%s.itable", - ctx->graph_id, trav->name); - } + if (ctx->measure_latency) + gf_proc_dump_latency_info (trav); - if (!trav->dumpops) { - trav = trav->next; - continue; - } + gf_proc_dump_xlator_mem_info(trav); - if (trav->dumpops->priv && - GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv)) - trav->dumpops->priv (trav); + if (GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode) && + (trav->itable)) { + snprintf (itable_key, 1024, "%d.%s.itable", + ctx->graph_id, trav->name); + } - if (GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode) && - (trav->dumpops->inode)) - trav->dumpops->inode (trav); - if (trav->dumpops->fd && - GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd)) - trav->dumpops->fd (trav); + if (!trav->dumpops) { + return; + } + + if (trav->dumpops->priv && + GF_PROC_DUMP_IS_XL_OPTION_ENABLED (priv)) + trav->dumpops->priv (trav); + + if (GF_PROC_DUMP_IS_XL_OPTION_ENABLED (inode) && + (trav->dumpops->inode)) + trav->dumpops->inode (trav); + if (trav->dumpops->fd && + GF_PROC_DUMP_IS_XL_OPTION_ENABLED (fd)) + trav->dumpops->fd (trav); - if (trav->dumpops->history && - GF_PROC_DUMP_IS_XL_OPTION_ENABLED (history)) - trav->dumpops->history (trav); + if (trav->dumpops->history && + GF_PROC_DUMP_IS_XL_OPTION_ENABLED (history)) + trav->dumpops->history (trav); +} +static void +gf_proc_dump_per_xlator_info (xlator_t *top) +{ + xlator_t *trav = top; + + while (trav && !trav->cleanup_starting) { + gf_proc_dump_single_xlator_info (trav); trav = trav->next; } } @@ -899,7 +908,7 @@ gf_proc_dump_info (int signum, glusterfs_ctx_t *ctx) if (ctx->master) { gf_proc_dump_add_section ("fuse"); - gf_proc_dump_xlator_info (ctx->master, _gf_false); + gf_proc_dump_single_xlator_info (ctx->master); } if (ctx->active) { |