Skip to content

gfapi: dump the active inode table in statedumps - #4839

Draft
ThalesBarretto wants to merge 2 commits into
gluster:develfrom
ThalesBarretto:fix/gfapi-statedump-itable
Draft

ThalesBarretto wants to merge 2 commits into
gluster:develfrom
ThalesBarretto:fix/gfapi-statedump-itable

Conversation

@ThalesBarretto

Copy link
Copy Markdown
Contributor

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 in statedump.c has been
dead since 4e40d9d6d7 (2012) — gf_proc_dump_single_xlator_info() still builds the section key and then
never calls inode_table_dump(). FUSE mounts and bricks dump their tables themselves.

Fix

  1. Give the gfapi master xlator an .inode dumper modelled on fuse_itable_dump() (gNFS had the same gap closed with
    its own dumper: BZ#1419870, reported 2017, landed 2019 in 8c66ebe35a): section xlator.mount.api.itable with the table sizes and the
    active/lru/purge inodes, each with its refs, per-xlator ref counts (ref_by_xl:), fd counts, and the
    per-xlator inode and fd contexts where an xlator set one.
  2. Remove the dead itable_key in gf_proc_dump_single_xlator_info() so nobody reads it as a working generic
    itable 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:

[xlator.mount.api.itable]
xlator.mount.api.itable.active_size=11
xlator.mount.api.itable.lru_size=0
[xlator.mount.api.itable.active.1]
gfid=37a46317-6c31-4f6f-a0bd-69de3ad56230
fd-count=1
active-fd-count=1
ref=2
ref_by_xl:.gfapi=1
ref_by_xl:.vol4490-open-behind=1

and with the #3977 fix applied: active_size=1, lru_size=10, the file inodes idle with fd-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 with trylock and skips the table when busy, as it
does for FUSE; fs->active_subvol is read without the fs lock, as fuse_itable_dump() reads
priv->active_subvol; only the active graph's table is dumped (old graphs still carry the 2012 TODO in
gf_proc_dump_oldgraph_xlator_info()); the section obeys the inode statedump option, so a consumer with a
very large table can turn it off through glusterdump.options.

Fixes: #4838

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
ThalesBarretto marked this pull request as draft September 22, 2026 10:01
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.

gfapi: statedumps of a gfapi process never contain its inode table

1 participant