Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH 1/3] ext4: check return value of blkdev_issue_flush() when initializing inode tables
@ 2026-10-13  6:26 guolingxing
  2026-10-13  6:26 ` [PATCH 2/3] ext4: check return value of blkdev_issue_flush() when starting a fast commit guolingxing
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: guolingxing @ 2026-10-13  6:26 UTC (permalink / raw)
  To: tytso
  Cc: adilger.kernel, libaokun, jack, ojaswin, ritesh.list, yi.zhang,
	linux-ext4, linux-kernel, stable, guolingxing

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@vger.kernel.org
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
---
 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


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

end of thread, other threads:[~2026-10-13  8:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13  6:26 [PATCH 1/3] ext4: check return value of blkdev_issue_flush() when initializing inode tables guolingxing
2026-10-13  6:26 ` [PATCH 2/3] ext4: check return value of blkdev_issue_flush() when starting a fast commit guolingxing
2026-10-13  6:42   ` sashiko-bot
2026-10-13  6:26 ` [PATCH 3/3] ext4: check return value of blkdev_issue_flush() when replaying fast commits guolingxing
2026-10-13  6:36   ` sashiko-bot
2026-10-13  6:39 ` [PATCH 1/3] ext4: check return value of blkdev_issue_flush() when initializing inode tables sashiko-bot
2026-10-13  8:23 ` [PATCH v2 0/2] ext4: check return value of blkdev_issue_flush() in unchecked call sites guolingxing
2026-10-13  8:23   ` [PATCH v2 1/2] ext4: check return value of blkdev_issue_flush() when initializing inode tables guolingxing
2026-10-13  8:39     ` sashiko-bot
2026-10-13  8:23   ` [PATCH v2 2/2] ext4: check return value of blkdev_issue_flush() when starting a fast commit guolingxing
2026-10-13  8:34     ` sashiko-bot

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