summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-11-14 15:26:30 +0530
committerAmar Tumballi <amarts@redhat.com>2018-11-15 04:46:50 +0000
commit013c8295d7cd7f5ad52bcf2585936ed320b8bbc7 (patch)
tree4a16baa5b735867664580c156796aa96319a719c
parent4c17065a02fb32acda32aac64da93ea5d326a7d5 (diff)
glusterfsd: Make io-stats xlator search position independent
Problem: glusterfsd notify trigger for profile info command expects decompounder xlator to have the name of the brick and its immediate child to be io-stats xlator. In GD2 decompounder xlator doesn't exist, so this is preventing io-stats xlator from receiving the profile info collection notification. Fix: search for io-stats xlator below server xlator till the first instance is found and send notification for it. fixes bz#1649709 Change-Id: I92a1d9019bbd5546050ab43d50d571c444e027ed Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 9c9cca2060c..2ce56f2bb18 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -433,18 +433,20 @@ cont:
xlator = get_xlator_by_name(any, xlator_req.name);
if (!xlator) {
+ ret = -1;
snprintf(msg, sizeof(msg), "xlator %s is not loaded", xlator_req.name);
goto out;
}
- /*
- * Searching by name will only get us to the decompounder translator,
- * but we really want io-stats. Since we know the exact relationship
- * between these two, it's easy to get from one to the other.
- *
- * TBD: should this even be notify, or something else?
- */
- xlator = FIRST_CHILD(xlator);
+ if (strcmp(xlator->type, "debug/io-stats")) {
+ xlator = get_xlator_by_type(xlator, "debug/io-stats");
+ if (!xlator) {
+ ret = -1;
+ snprintf(msg, sizeof(msg),
+ "xlator-type debug/io-stats is not loaded");
+ goto out;
+ }
+ }
output = dict_new();
ret = xlator->notify(xlator, GF_EVENT_TRANSLATOR_INFO, dict, output);