The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v2] fs: expand dump_inode()
@ 2025-09-11  6:56 Mateusz Guzik
  2025-09-15 12:31 ` Christian Brauner
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Guzik @ 2025-09-11  6:56 UTC (permalink / raw)
  To: brauner; +Cc: viro, jack, linux-kernel, david, linux-fsdevel, Mateusz Guzik

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

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

Compile tested on i386 and runtime tested on amd64.

Sample output:
[   23.121281] VFS_WARN_ON_INODE("crap") encountered for inode ffff9a1a83ce3660
               fs pipefs mode 10600 opflags 0x4 flags 0x0 state 0x38 count 0

Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---

v2:
- use 0x for hex values
- add i_count

generated against master, cosmetic changes are needed against the
vfs-6.18.inode.refcount.preliminaries branch.

 fs/inode.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/inode.c b/fs/inode.c
index 01ebdc40021e..95fada5c45ea 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -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 0x%hx flags 0x%x state 0x%x count %d\n",
+		reason, inode, sb->s_type->name, inode->i_mode, inode->i_opflags,
+		inode->i_flags, inode->i_state, atomic_read(&inode->i_count));
 }
 
 EXPORT_SYMBOL(dump_inode);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] fs: expand dump_inode()
  2025-09-11  6:56 [PATCH v2] fs: expand dump_inode() Mateusz Guzik
@ 2025-09-15 12:31 ` Christian Brauner
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-09-15 12:31 UTC (permalink / raw)
  To: Mateusz Guzik; +Cc: viro, jack, linux-kernel, david, linux-fsdevel

On Thu, Sep 11, 2025 at 08:56:41AM +0200, Mateusz Guzik wrote:
> This adds fs name and few fields from struct inode: i_mode, i_opflags,
> i_flags, i_state and i_count.
> 
> All values printed raw, no attempt to pretty-print anything.
> 
> Compile tested on i386 and runtime tested on amd64.
> 
> Sample output:
> [   23.121281] VFS_WARN_ON_INODE("crap") encountered for inode ffff9a1a83ce3660
>                fs pipefs mode 10600 opflags 0x4 flags 0x0 state 0x38 count 0
> 
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
> ---
> 
> v2:

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-09-15 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-11  6:56 [PATCH v2] fs: expand dump_inode() Mateusz Guzik
2025-09-15 12:31 ` Christian Brauner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox