Skip to contentSkip to conversation

fs: expand dump_inode()

PATCH Applied Mateusz Guzik 2 participants 4 messages Sep 9, 2025 – Sep 15, 2025 VFS

v1 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: expand dump_inode()

This adds fs name and few fields from struct inode: i_mode, i_opflags, i_flags and i_state.

All values printed raw, no attempt to pretty-print anything.

Compile tested on for i386 and runtime tested on amd64.

Sample output:

[   31.450263] VFS_WARN_ON_INODE("crap") encountered for inode ffff9b10837a3240
               fs sockfs mode 140777 opflags c flags 0 state 100

---

This is generated against master.

Depending on where this lands you might get a trivial merge conflict as
it gets rid of the whitespace issue also fixed in https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/commit/?h=vfs-6.18.inode.refcount.preliminaries&id=90ccf10de527c0c9b117beddd09ee7ac38efaa5b

 fs/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
fs/inode.c +9 -1
index 01ebdc40021e..fe7591186b6e 100644
@@ -2911,10 +2911,18 @@ EXPORT_SYMBOL(mode_strip_sgid);
  *
  * TODO: add a proper inode dumping routine, this is a stub to get debug off the
  * ground.
+ *
+ * TODO: handle getting to fs type with get_kernel_nofault().
+ * See dump_mapping() above.
  */
 void dump_inode(struct inode *inode, const char *reason)
 {
-       pr_warn("%s encountered for inode %px", reason, inode);
+	struct super_block *sb = inode->i_sb;
+
+	pr_warn("%s encountered for inode %px\n"
+		"fs %s mode %ho opflags %hx flags %u state %x\n",
+		reason, inode, sb->s_type->name, inode->i_mode, inode->i_opflags,
+		inode->i_flags, inode->i_state);
 }
 
 EXPORT_SYMBOL(dump_inode);
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Mateusz Guzik

This adds fs name and few fields from struct inode: i_mode, i_opflags, i_flags and i_state.

All values printed raw, no attempt to pretty-print anything.

Quoted 8 lines

Compile tested on for i386 and runtime tested on amd64.

Sample output:

[   31.450263] VFS_WARN_ON_INODE("crap") encountered for inode ffff9b10837a3240
               fs sockfs mode 140777 opflags c flags 0 state 100

---

Applied to vfs-6.18.misc.

#2 lore raw
Quoted 9 lines · Christian Brauner
Quoted 7 lines · Mateusz Guzik

This adds fs name and few fields from struct inode: i_mode, i_opflags, i_flags and i_state.

All values printed raw, no attempt to pretty-print anything.

Compile tested on for i386 and runtime tested on amd64.

Quoted 8 lines
Quoted 6 lines

Sample output:

[   31.450263] VFS_WARN_ON_INODE("crap") encountered for inode ffff9b10837a3240
               fs sockfs mode 140777 opflags c flags 0 state 100

---

Applied to vfs-6.18.misc.

I posted a v2: https://lore.kernel.org/linux-fsdevel/[email protected]/

#3 lore raw
Quoted 14 lines · Mateusz Guzik
Quoted 13 lines · Christian Brauner
Quoted 11 lines · Mateusz Guzik

This adds fs name and few fields from struct inode: i_mode, i_opflags, i_flags and i_state.

All values printed raw, no attempt to pretty-print anything.

Compile tested on for i386 and runtime tested on amd64.

Sample output:

[   31.450263] VFS_WARN_ON_INODE("crap") encountered for inode ffff9b10837a3240
               fs sockfs mode 140777 opflags c flags 0 state 100
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

---

Applied to vfs-6.18.misc.

I posted a v2: https://lore.kernel.org/linux-fsdevel/[email protected]/

Yeah, I picked that.