[PATCH 1/3] ext4: check return value of blkdev_issue_flush() when initializing inode tables

From: guolingxing

Date: Tue Oct 13 2026 - 02:31:59 EST


When lazily zeroing an inode table, ext4_init_inode_table() issues a
cache flush to make sure the zeroed blocks have reached the disk
before setting the EXT4_BG_INODE_ZEROED flag, but the return value is
ignored. If the cache flush fails, the inode table is still marked as
initialized, and a subsequent crash can leave the table containing
stale data from the previous use of the disk, which may then be
exposed to user space through newly allocated inodes.

Check the return value of blkdev_issue_flush() and leave
EXT4_BG_INODE_ZEROED unset if the cache flush fails, so that the inode
table zeroing is retried on the next mount.

Fixes: a107e5a3a473a ("Merge branch 'next' into upstream-merge")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: guolingxing <guolingxing@xxxxxxxxxx>
---
fs/ext4/ialloc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index a5831fc536db..9abd7fb75b02 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1610,8 +1610,11 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
ret = sb_issue_zeroout(sb, blk, num, GFP_NOFS);
if (ret < 0)
goto err_out;
- if (barrier)
- blkdev_issue_flush(sb->s_bdev);
+ if (barrier) {
+ ret = blkdev_issue_flush(sb->s_bdev);
+ if (ret)
+ goto err_out;
+ }

skip_zeroout:
ext4_lock_group(sb, group);
--
2.34.1