All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Yeongjin Gil <youngjin.gil@samsung.com>,
	jaegeuk@kernel.org, daehojeong@google.com,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: sj1557.seo@samsung.com
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix to avoid atomicity corruption of atomic file
Date: Mon, 17 Mar 2025 11:19:07 +0800	[thread overview]
Message-ID: <a6137820-5dde-4b81-a330-ad0ff42bc607@kernel.org> (raw)
In-Reply-To: <20250314120651.443184-1-youngjin.gil@samsung.com>

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@samsung.com>
> Reviewed-by: Sunmin Jeong <s_min.jeong@samsung.com>
> Signed-off-by: Yeongjin Gil <youngjin.gil@samsung.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: Chao Yu <chao@kernel.org>
To: Yeongjin Gil <youngjin.gil@samsung.com>,
	jaegeuk@kernel.org, daehojeong@google.com,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: chao@kernel.org, sj1557.seo@samsung.com, s_min.jeong@samsung.com
Subject: Re: [PATCH] f2fs: fix to avoid atomicity corruption of atomic file
Date: Mon, 17 Mar 2025 11:19:07 +0800	[thread overview]
Message-ID: <a6137820-5dde-4b81-a330-ad0ff42bc607@kernel.org> (raw)
In-Reply-To: <20250314120651.443184-1-youngjin.gil@samsung.com>

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@samsung.com>
> Reviewed-by: Sunmin Jeong <s_min.jeong@samsung.com>
> Signed-off-by: Yeongjin Gil <youngjin.gil@samsung.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

  parent reply	other threads:[~2025-03-17  3:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20250314120658epcas1p2d3ec037c294d4c907ce7fa2fe1c3aa27@epcas1p2.samsung.com>
2025-03-14 12:06 ` [f2fs-dev] [PATCH] f2fs: fix to avoid atomicity corruption of atomic file Yeongjin Gil
2025-03-14 12:06   ` Yeongjin Gil
2025-03-14 19:04   ` [f2fs-dev] " Daeho Jeong
2025-03-14 19:04     ` Daeho Jeong
2025-03-14 21:50   ` Jaegeuk Kim via Linux-f2fs-devel
2025-03-14 21:50     ` Jaegeuk Kim
2025-03-14 22:21     ` [f2fs-dev] " Jaegeuk Kim via Linux-f2fs-devel
2025-03-14 22:21       ` Jaegeuk Kim
2025-03-14 22:30   ` [f2fs-dev] " patchwork-bot+f2fs--- via Linux-f2fs-devel
2025-03-14 22:30     ` patchwork-bot+f2fs
2025-03-17  3:19   ` Chao Yu via Linux-f2fs-devel [this message]
2025-03-17  3:19     ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6137820-5dde-4b81-a330-ad0ff42bc607@kernel.org \
    --to=linux-f2fs-devel@lists.sourceforge.net \
    --cc=chao@kernel.org \
    --cc=daehojeong@google.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=youngjin.gil@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.