[PATCH OLK-6.6] ext4: fix stale data issue on the iomap path
Offering: HULK hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8430 -------------------------------- There is a stale data issue caused by merging 9e891675aab8. After the patch was merged, data writeback before punch hole cancellation was canceled. This led to some regions of unwritten extents not being zeroed, ultimately exposing stale data. Fixes: 9e891675aab8 ("ext4: don't write back data before punch hole in nojournal mode") Signed-off-by: Yongjian Sun <sunyongjian1@huawei.com> --- fs/ext4/inode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 84a09f3e6d49..cc4eeccc0dd7 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4696,13 +4696,12 @@ int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) ret = ext4_update_disksize_before_punch(inode, offset, length); if (ret) goto out_dio; - - ret = ext4_truncate_page_cache_block_range(inode, - first_block_offset, last_block_offset + 1); - if (ret) - goto out_dio; } + ret = ext4_truncate_page_cache_block_range(inode, offset, offset + length); + if (ret) + goto out_dio; + if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) credits = ext4_writepage_trans_blocks(inode); else -- 2.39.2
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/20308 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UXW... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/20308 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/UXW...
participants (2)
-
patchwork bot -
Yongjian Sun