Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ext4: unify SYNC mode checks in fallocate paths

In the ext4 fallocate call chain, SYNC mode handling is inconsistent:
some places check the inode state, while others check the open file
descriptor state. Unify these checks by evaluating both conditions
to ensure consistent behavior across all fallocate operations.

Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260327102939.1095257-11-yi.zhang@huaweicloud.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>

authored by

Zhang Yi and committed by
Theodore Ts'o
c3688d21 7d81ec02

+6 -5
+5 -4
fs/ext4/extents.c
··· 4782 4782 goto out_handle; 4783 4783 4784 4784 ext4_update_inode_fsync_trans(handle, inode, 1); 4785 - if (file->f_flags & O_SYNC) 4785 + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) 4786 4786 ext4_handle_sync(handle); 4787 4787 4788 4788 out_handle: ··· 4820 4820 if (ret) 4821 4821 goto out; 4822 4822 4823 - if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) { 4823 + if (((file->f_flags & O_SYNC) || IS_SYNC(inode)) && 4824 + EXT4_SB(inode->i_sb)->s_journal) { 4824 4825 ret = ext4_fc_commit(EXT4_SB(inode->i_sb)->s_journal, 4825 4826 EXT4_I(inode)->i_sync_tid); 4826 4827 } ··· 5594 5593 goto out_handle; 5595 5594 5596 5595 ext4_update_inode_fsync_trans(handle, inode, 1); 5597 - if (IS_SYNC(inode)) 5596 + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) 5598 5597 ext4_handle_sync(handle); 5599 5598 5600 5599 out_handle: ··· 5718 5717 goto out_handle; 5719 5718 5720 5719 ext4_update_inode_fsync_trans(handle, inode, 1); 5721 - if (IS_SYNC(inode)) 5720 + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) 5722 5721 ext4_handle_sync(handle); 5723 5722 5724 5723 out_handle:
+1 -1
fs/ext4/inode.c
··· 4531 4531 goto out_handle; 4532 4532 4533 4533 ext4_update_inode_fsync_trans(handle, inode, 1); 4534 - if (IS_SYNC(inode)) 4534 + if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) 4535 4535 ext4_handle_sync(handle); 4536 4536 out_handle: 4537 4537 ext4_journal_stop(handle);