Skip to content

mountstats: fix the column order of NFS over RDMA transport stats - #908

Open
amdadulbari wants to merge 1 commit into
prometheus:masterfrom
amdadulbari:fix/mountstats-rdma-xprt-field-order
Open

amdadulbari wants to merge 1 commit into
prometheus:masterfrom
amdadulbari:fix/mountstats-rdma-xprt-field-order

Conversation

@amdadulbari

Copy link
Copy Markdown

@SuperQ @discordianfish

parseNFSTransportStats assigned the xprt: rdma columns of /proc/<pid>/mountstats in the field order of the kernel's struct rpcrdma_stats, but xprt_rdma_print_stats() (net/sunrpc/xprtrdma/transport.c) prints them in a different order:

read_chunk write_chunk reply_chunk total_rdma_request total_rdma_reply
pullup_copy fixup_copy hardway_register failed_marshal bad_reply
nomsg_call mrs_recycled mrs_orphaned mrs_allocated local_inv_needed
empty_sendctx_q reply_waits_for_send

This order is the same in every kernel since v4.2; later kernels only append columns (current kernels print a constant 0 in the reply_waits_for_send position). Only the first four RDMA columns were mapped correctly; for example the total_rdma_reply byte count ended up in PullupCopyCount, and TotalRdmaReply received mrs_orphaned. bcall_count is never printed, so BcallCount stays zero.

Changes:

  • Read the RDMA columns in the order the kernel prints them.
  • Add TestParseNFSTransportStatsRDMAFieldOrder, which uses a distinct value per column (fails before this change).
  • Correct the expected values of the existing RDMA case in TestMountStats, which encoded the wrong mapping.

The mapping was introduced in #558. node_exporter does not expose these fields yet (see prometheus/node_exporter#2825).

parseNFSTransportStats assigned the RDMA xprt columns in the field
order of the kernel's struct rpcrdma_stats, but the kernel prints them
in a different order in xprt_rdma_print_stats()
(net/sunrpc/xprtrdma/transport.c):

  read_chunk write_chunk reply_chunk total_rdma_request
  total_rdma_reply pullup_copy fixup_copy hardway_register
  failed_marshal bad_reply nomsg_call mrs_recycled mrs_orphaned
  mrs_allocated local_inv_needed empty_sendctx_q reply_waits_for_send

This order has been stable since the RDMA stats were added; later
kernels only append columns. Only the first four RDMA columns were
read correctly. Every column after total_rdma_request landed in the
wrong field, e.g. the total_rdma_reply byte count was reported as
PullupCopyCount, and TotalRdmaReply received the mrs_allocated count.

Read the columns in the order the kernel prints them. bcall_count is
not printed by the kernel, so BcallCount stays zero.

Add a test with a distinct value in every column, and correct the
expected values of the existing RDMA test case, which encoded the
wrong mapping.

Signed-off-by: Md. Amdadul Bari Imad <amdadulbari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant