[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a6137820-5dde-4b81-a330-ad0ff42bc607@kernel.org>
Date: Mon, 17 Mar 2025 11:19:07 +0800
From: Chao Yu <chao@...nel.org>
To: Yeongjin Gil <youngjin.gil@...sung.com>, jaegeuk@...nel.org,
daehojeong@...gle.com, linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Cc: chao@...nel.org, sj1557.seo@...sung.com, s_min.jeong@...sung.com
Subject: Re: [PATCH] f2fs: fix to avoid atomicity corruption of atomic file
On 3/14/25 20:06, Yeongjin Gil wrote:
> 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.
I guess we need to add a regression testcase to cover this issue.
>
> Fixes: fccaa81de87e ("f2fs: prevent atomic file from being dirtied before commit")
> Reviewed-by: Sungjong Seo <sj1557.seo@...sung.com>
> Reviewed-by: Sunmin Jeong <s_min.jeong@...sung.com>
> Signed-off-by: Yeongjin Gil <youngjin.gil@...sung.com>
Reviewed-by: Chao Yu <chao@...nel.org>
Thanks,
Powered by blists - more mailing lists