For a file marked synchronous with chattr +S, ext2_setsize() writes the changed inode metadata before returning from truncate. It currently ignores the result of sync_inode_metadata(). If the inode-table write fails, a caller can receive success even though the new size was not persisted. On an unmodified kernel from the ext2 for_next tree, a QEMU guest used GNU truncate to clear an 8 KiB ext2 file marked +S. A targeted write error on that file's inode-table block was reported by ext2, but ftruncate() returned 0. After an abrupt guest stop and a fault-free read-only mount, the original file and its hash remained. Two separate fault runs reproduced this result; the healthy control truncated the file durably. Return the synchronous metadata-write result through ext2_setsize() and its existing ext2_setattr() caller. With the same fault, GNU truncate now receives EIO in two runs; the healthy control still succeeds. This reports failed persistence to userspace. It does not roll back changes already made in memory or repair the filesystem after a device error. OpenAI Codex identified the ignored write result, drafted the fix and changelog, and prepared the QEMU truncate tests. Both fault runs on the changed kernel returned EIO. The healthy controls persisted the new file size on both kernels. Signed-off-by: Wesley Atwell --- fs/ext2/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 1989258aef8a..43d155bb09b6 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c @@ -1266,9 +1266,9 @@ static int ext2_setsize(struct inode *inode, loff_t newsize) inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); mark_inode_dirty(inode); if (inode_needs_sync(inode)) - sync_inode_metadata(inode, 1); + error = sync_inode_metadata(inode, 1); - return 0; + return error; } static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino, base-commit: cc226183b2c07b301f21af709b2f95c8c7050393