diff options
| -rw-r--r-- | tests/basic/stats-dump.t | 2 | ||||
| -rw-r--r-- | xlators/debug/io-stats/src/io-stats.c | 41 | 
2 files changed, 22 insertions, 21 deletions
diff --git a/tests/basic/stats-dump.t b/tests/basic/stats-dump.t index ceed7571a62..af1ad34702b 100644 --- a/tests/basic/stats-dump.t +++ b/tests/basic/stats-dump.t @@ -39,7 +39,7 @@ FUSE_RET="$?"  # Test that io-stats is getting queue sizes from io-threads  TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfs_nfsd_$V0.dump -TEST grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump +TEST ! grep 'queue_size' ${GLUSTERD_WORKDIR}/stats/glusterfsd__d_backends_patchy?.dump  TEST [ 0 -ne "$BRICK_RET" ]  TEST [ 0 -ne "$NFSD_RET" ] diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c index 101803f470d..2835b0a3f6e 100644 --- a/xlators/debug/io-stats/src/io-stats.c +++ b/xlators/debug/io-stats/src/io-stats.c @@ -1152,28 +1152,29 @@ io_stats_dump_global_to_json_logfp (xlator_t *this,                  "\"%s.%s.fop.unweighted_latency_ave_usec\":\"%0.4lf\",",                  key_prefix, str_prefix, fop_ave_usec); -        dict_t *xattr = NULL; -        ret = syncop_getxattr (this, &unused_loc, &xattr, -                               IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); -        if (xattr) { -                // Iterate over the dictionary returned to us by io-threads and -                // dump the results to the stats file. -                data_pair_t *curr = NULL; -                dict_for_each (xattr, curr) { -                        ios_log (this, logfp, -                                  "\"%s.%s.%s.queue_size\": \"%d\",", -                                  key_prefix, str_prefix, curr->key, -                                  data_to_int32 (curr->value)); -                } +        if (conf->iamnfsd) { +                dict_t *xattr = NULL; +                ret = syncop_getxattr (this, &unused_loc, &xattr, +                                       IO_THREADS_QUEUE_SIZE_KEY, NULL, NULL); +                if (xattr) { +                        // Iterate over the dictionary returned to us by io-threads and +                        // dump the results to the stats file. +                        data_pair_t *curr = NULL; +                        dict_for_each (xattr, curr) { +                                ios_log (this, logfp, +                                          "\"%s.%s.%s.queue_size\": \"%d\",", +                                          key_prefix, str_prefix, curr->key, +                                          data_to_int32 (curr->value)); +                        } -                // Free the dictionary -                dict_unref (xattr); -        } else { -                gf_log (this->name, GF_LOG_WARNING, -                        "Unable to get queue size counts from " -                        "the io-threads translator!"); +                        // Free the dictionary +                        dict_unref (xattr); +                } else { +                        gf_log (this->name, GF_LOG_WARNING, +                                "Unable to get queue size counts from " +                                "the io-threads translator!"); +                }          } -          if (interval == -1) {                  ios_log (this, logfp, "\"%s.%s.uptime\": \"%"PRId64"\",",                           key_prefix, str_prefix,  | 
