f2fs: fix to avoid atomicity corruption of atomic file
In the case of the following call stack for an atomic file,
FI_DIRTY_INODE is set, but FI_ATOMIC_DIRTIED is not subsequently set.
f2fs_file_write_iter
f2fs_map_blocks
f2fs_reserve_new_blocks
inc_valid_block_count
__mark_inode_dirty(dquot)
f2fs_dirty_inode
If FI_ATOMIC_DIRTIED is not set, atomic file can encounter corruption
due to a mismatch between old file size and new data.
To resolve this issue, I changed to set FI_ATOMIC_DIRTIED when
FI_DIRTY_INODE is set. This ensures that FI_DIRTY_INODE, which was
previously cleared by the Writeback thread during the commit atomic, is
set and i_size is updated.
Cc: <stable@vger.kernel.org>
Fixes: fccaa81d ("f2fs: prevent atomic file from being dirtied before commit")
Reviewed-by:
Sungjong Seo <sj1557.seo@samsung.com>
Reviewed-by:
Sunmin Jeong <s_min.jeong@samsung.com>
Signed-off-by:
Yeongjin Gil <youngjin.gil@samsung.com>
Reviewed-by:
Daeho Jeong <daehojeong@google.com>
Reviewed-by:
Chao Yu <chao@kernel.org>
Signed-off-by:
Jaegeuk Kim <jaegeuk@kernel.org>
Loading
-
mentioned in commit cb95c541
-
mentioned in commit 23a5cd9a
-
mentioned in commit 0c6055fd
-
mentioned in commit 82bd41dd
-
mentioned in commit 4c94b4d5
-
mentioned in commit 80a0a02d
-
mentioned in commit 8152b973
-
mentioned in commit 039e7af7
-
mentioned in commit c7f15b8f
-
mentioned in commit 6567ab14
-
mentioned in commit e7598ed5
-
mentioned in commit a2521ca2
-
mentioned in commit ef4f8e39
-
mentioned in commit 2e0beaa1
-
mentioned in commit a5ed59a8
-
mentioned in commit cfa792a7
-
mentioned in commit d3735b22
-
mentioned in commit 7c12a3b0
-
mentioned in commit 047ff3ea
-
mentioned in commit c84ebfb9
-
mentioned in commit 70a0f2f5
-
mentioned in commit 34b97811
-
mentioned in commit 63fce907
Please sign in to comment