fs/ext4/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] ext4: add debug logging for setattr size operations
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
Add debug printk to track when ext4_setattr() is called with ATTR_SIZE,
logging the inode number, old size, new size, and whether the inode has
inline data flag set.
This is a diagnostic patch to investigate the crash reported by syzbot
where a BUG_ON() fires in ext4_write_inline_data() due to inodes having
the inline data flag set but claiming sizes far exceeding inline capacity.
The hypothesis is that truncate() operations that grow file size are not
properly converting inline data to extent-based storage, leaving inodes
in an inconsistent state (inline flag set + large size).
This debug output will confirm whether:
1. ext4_setattr() is called during truncate operations
2. The inline data flag remains set when size grows beyond capacity
3. Conversion to extent-based storage is missing from the truncate path
Related-to: syzbot+7de5fe447862fc37576f@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=7de5fe447862fc37576f
Signed-off-by: Deepanshu Kartikey <Kartikey406@gmail.com>
---
fs/ext4/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0c466ccbed69..ccaef3eb5a46 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -5886,7 +5886,8 @@ int ext4_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
loff_t oldsize = inode->i_size;
loff_t old_disksize;
int shrink = (attr->ia_size < inode->i_size);
-
+ printk(KERN_WARNING "EXT4-fs DEBUG setattr: inode=%lu old_size=%lld new_size=%lld has_inline=%d\n",
+ inode->i_ino,oldsize,attr->ia_size,ext4_has_inline_data(inode) ? 1 : 0);
if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
--
2.43.0
© 2016 - 2026 Red Hat, Inc.