mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: jiucheng.xu@amlogic.com, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	jianxin.pan@amlogic.com, tao.zeng@amlogic.com,
	tuan.zhang@amlogic.com
Subject: Re: [PATCH] f2fs: force out-place update for all writes on compressed file
Date: Tue, 8 Sep 2026 08:15:49 +0800	[thread overview]
Message-ID: <3c4629c6-536b-44de-add4-39df3381e7d1@kernel.org> (raw)
In-Reply-To: <20260907-origin-dev-v1-1-85ae7ebc8c98@amlogic.com>

On 9/7/26 19:35, Jiucheng Xu via B4 Relay wrote:
> From: Jiucheng Xu <jiucheng.xu@amlogic.com>
> 
> For compressed file, compressed write may fail and fall back to raw
> write.
> 
> -Thread A                                         - Thread B
>    - f2fs_write_multi_pages                          - f2fs_down_write(&sbi->cp_rwsem);
>     - f2fs_write_compressed_pages                    - ...
>      - f2fs_trylock_op                               - ...
>       - f2fs_down_read_trylock(&sbi->cp_rwsem);      - ...
>     - f2fs_write_raw_pages                           - ...
> 
> Thread B acquires the lock first, which causes Thread A to fail lock
> acquisition and fall back to raw-data write.
> IPU_FORCE is enabled on small-capacity storage devices (< 16GB),
> so f2fs_write_raw_pages() overwrites the original compressed data
> in-place.
> 
> The in-memory node has been updated with raw-data addresses, while the
> node metadata stored on eMMC still remains in compressed state.
> If a power-cut occurs before the node is flushed to disk, on-disk
> inconsistency arises: disk data is raw, yet metadata treats it as a
> compressed cluster, leading to decompression failure.
> 
> To eliminate this risk completely, force out-place update for all
> write operations on compressed file.
> 

Cc: stable@kernel.org
Fixes: 4c8ff7095bef ("f2fs: support data compression")

> Signed-off-by: Jiucheng Xu <jiucheng.xu@amlogic.com>

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

Thanks,

  reply	other threads:[~2026-09-08  0:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 11:35 Jiucheng Xu via B4 Relay
2026-09-08  0:15 ` Chao Yu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-08-26  8:48 Jiucheng Xu via B4 Relay

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=3c4629c6-536b-44de-add4-39df3381e7d1@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=jianxin.pan@amlogic.com \
    --cc=jiucheng.xu@amlogic.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tao.zeng@amlogic.com \
    --cc=tuan.zhang@amlogic.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®