summaryrefslogtreecommitdiff
path: root/include/uapi/linux/errqueue.h
diff options
context:
space:
mode:
authorZhang Yi <yi.zhang@huawei.com>2026-09-03 20:35:36 +0800
committerTheodore Ts'o <tytso@mit.edu>2026-10-08 11:11:25 -0400
commitdce8729e91d2b967574a94e2636adbbb97dea44f (patch)
treef595abf7225b59426fad881aaa66ccfe666c9c13 /include/uapi/linux/errqueue.h
parent61bf54b10d4fdcb32ce0cd625dfc14e7f2c02359 (diff)
downloadlinux-next-dce8729e91d2b967574a94e2636adbbb97dea44f.tar.gz
linux-next-dce8729e91d2b967574a94e2636adbbb97dea44f.zip
ext4: defer i_disksize update while DISKSIZE_GROW_PENDING is set
Operations like append allocate, zero range, and truncate update i_disksize directly. If the new i_disksize exceeds the original value while the zeroed EOF block is still awaiting writeback, metadata may be persisted before the zeroed data, exposing stale data on crash. Defer i_disksize updates while EXT4_STATE_DISKSIZE_GROW_PENDING is set; the ioend worker for the pending block will advance i_disksize to i_size once the zeroed data is written back. The tradeoff is that i_disksize may lag i_size transiently, but this is observable only to callers that read i_disksize directly. Introduce __ext4_set_i_disksize() to centralize the bit check for callers already holding i_data_sem (ext4_ext_truncate and ext4_set_inode_size), and refactor ext4_update_inode_size() to take i_data_sem itself and check the bit atomically with i_size_write(), so the ioend worker observes the latest i_size under the same lock. Note that in the O_SYNC mode of ext4_do_fallocate() or ext4_zero_range(), we need to flush out pending blocks that can update i_disksize synchronously. This will be handled later, and EXT4_STATE_DISKSIZE_GROW_PENDING will also be set after everything is done. Suggested-by: Jan Kara <jack@suse.cz> Signed-off-by: Zhang Yi <yi.zhang@huawei.com> Link: https://patch.msgid.link/20260903123543.2302999-25-yi.zhang@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/uapi/linux/errqueue.h')
0 files changed, 0 insertions, 0 deletions