From 013c8295d7cd7f5ad52bcf2585936ed320b8bbc7 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 14 Nov 2018 15:26:30 +0530 Subject: 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 --- glusterfsd/src/glusterfsd-mgmt.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'glusterfsd') 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); -- cgit