diff options
| author | Zhang Yi <yi.zhang@huawei.com> | 2026-07-29 16:59:18 +0800 |
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2026-07-30 10:57:13 -0400 |
| commit | f7237a775c8f3e99e0e77b7c10fb626815fb2877 (patch) | |
| tree | 5c1d2dad74fbd6e201b88aaffb7677862b9ac53c /tools/perf/scripts/python/syscall-counts.py | |
| parent | 5b3dcb924a38ecd2c0d828ff30c357357eda1da8 (diff) | |
ext4: protect WRITE_ZEROES written extents with orphan list
In ext4_alloc_file_blocks(), the WRITE_ZEROES path converts unwritten
extents to written in one transaction, while i_disksize is updated to
cover them only in a later transaction. A crash in between leaves
written extents beyond i_disksize on disk, which fsck will complain
about.
To fix this, add the inode to the orphan list in the same handle that
does the conversion, and remove it once i_disksize has caught up.
Also add a sanity check to ensure conversion does not extend beyond EOF.
Since ext4_alloc_file_blocks() is called from the fallocate() path,
partial allocation is safe. On partial conversion failure, advance
i_disksize only up to the boundary of successfully converted blocks, so
that orphan cleanup sees a consistent state. Document this behavior in
the function comment.
Reported-by: Jan Kara <jack@suse.cz>
Closes: https://lore.kernel.org/linux-ext4/3f6ao5amv7glbgigndtegcucgo3n34ij3lau6l3da3hgdxgn3v@ev66wv3r5umt/
Fixes: f4265b8d32c4 ("ext4: add FALLOC_FL_WRITE_ZEROES support")
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260729085918.3336221-3-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions
