gfapi: dump the active inode table in statedumps - #4839
Draft
ThalesBarretto wants to merge 2 commits into
Draft
ThalesBarretto wants to merge 2 commits into
ThalesBarretto wants to merge 2 commits into
Conversation
A gfapi process's statedump has never contained its inode table: the table hangs off the active graph's top xlator (graph_setup), which has no dumpops, and the generic per-xlator itable dump in statedump.c has been dead since 4e40d9d (2012) -- gf_proc_dump_single_xlator_info() still builds the section key and then never calls inode_table_dump(). FUSE mounts and bricks are unaffected because they dump their tables themselves (fuse_itable_dump, client_t's per-connection dump), and gNFS had the same gap closed with its own dumper (BZ#1419870, 8c66ebe, "xlator.nfs.itable"). Give the gfapi master xlator an .inode dumper modelled on fuse_itable_dump(): the section "xlator.mount.api.itable" with the active graph's table sizes and its active/lru/purge inodes, each with its refs, per-xlator ref counts and fd counts, and the per-xlator inode and fd contexts where an xlator set one. This is what makes an fd or inode leak in a gfapi consumer (Samba, NFS-Ganesha, qemu) visible in a statedump at all: on a default (tcmalloc) build there is no fd_t mem-pool count either, so a leaked fd left only an accounted _ctx array to count. Fixes: gluster#4838 Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
Since 4e40d9d (2012, "protocol/server: dump the ltable and fd table related inodes only") the section key "<graph>.<xlator>.itable" is built for every xlator that owns an inode table and then never used: the inode_table_dump() call it was meant for was removed with that change. Remove the leftover so nobody reads it as a working generic itable dump (fuse, bricks and now gfapi dump their tables through .inode dumpops). Updates: gluster#4838 Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
ThalesBarretto
marked this pull request as draft
September 22, 2026 10:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gfapi: dump the active inode table in statedumps
Problem
A gfapi process's statedump has never contained its inode table: the table hangs off the active graph's top
xlator (
graph_setup), which has no dumpops, and the generic per-xlator itable dump instatedump.chas beendead since
4e40d9d6d7(2012) —gf_proc_dump_single_xlator_info()still builds the section key and thennever calls
inode_table_dump(). FUSE mounts and bricks dump their tables themselves.Fix
.inodedumper modelled onfuse_itable_dump()(gNFS had the same gap closed withits own dumper: BZ#1419870, reported 2017, landed 2019 in
8c66ebe35a): sectionxlator.mount.api.itablewith the table sizes and theactive/lru/purge inodes, each with its refs, per-xlator ref counts (
ref_by_xl:), fd counts, and theper-xlator inode and fd contexts where an xlator set one.
itable_keyingf_proc_dump_single_xlator_info()so nobody reads it as a working genericitable dump.
What it shows
A gfapi program that opens 10 files and closes them without I/O under
performance.open-behind on(the leak of#3977), statedump via
glfs_sysrq(), on a stock devel build with this change:and with the #3977 fix applied:
active_size=1,lru_size=10, the file inodes idle withfd-count=0 ref=0.Without this change the same dump has no inode information at all (0 itable sections).
Notes for review:
inode_table_dump()takes the table lock withtrylockand skips the table when busy, as itdoes for FUSE;
fs->active_subvolis read without the fs lock, asfuse_itable_dump()readspriv->active_subvol; only the active graph's table is dumped (old graphs still carry the 2012 TODO ingf_proc_dump_oldgraph_xlator_info()); the section obeys theinodestatedump option, so a consumer with avery large table can turn it off through
glusterdump.options.Fixes: #4838