mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 10:31:33 -04:00
ext4: skip tail block zeroing for inline data files
ext4_block_zero_eof() is called from ext4_write_checks() on every
append write beyond EOF. For inline data files, ext4_get_block()
returns -ERANGE when ext4_load_tail_bh() looks up the tail block.
However, this error is currently ignored because the return value
of ext4_get_block() in ext4_load_tail_bh() is discarded.
Before we fix ext4_load_tail_bh() to properly propagate the error,
skip the zeroing for inline data inodes to avoid unnecessary
failures or confusion.
Fixes: 3f60efd654 ("ext4: zero post-EOF partial block before appending write")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260714080044.4038124-3-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
@@ -4234,6 +4234,14 @@ int ext4_block_zero_eof(struct inode *inode, loff_t from, loff_t end)
|
||||
offset = from & (blocksize - 1);
|
||||
if (!offset || from >= end)
|
||||
return 0;
|
||||
/*
|
||||
* Inline data has no tail block to zero out. Note that a race with
|
||||
* ext4_page_mkwrite() converting inline data to an extent without
|
||||
* holding i_rwsem is safe, as that path zeroes the full block before
|
||||
* copying in the inline data.
|
||||
*/
|
||||
if (ext4_has_inline_data(inode))
|
||||
return 0;
|
||||
/* If we are processing an encrypted inode during orphan list handling */
|
||||
if (IS_ENCRYPTED(inode) && !fscrypt_has_encryption_key(inode))
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user