From: Chao Yu <chao@kernel.org>
To: fengnan chang <fengnanchang@gmail.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix hungtask when decompressed fail
Date: Tue, 1 Nov 2022 23:06:35 +0800 [thread overview]
Message-ID: <cae1e1e9-d528-496e-d89d-be47c4b8d0cb@kernel.org> (raw)
In-Reply-To: <CALWNXx9F+pZa9b7Bui=A9L66pO=64H6kwzNUtSfJsbLsvPBLMQ@mail.gmail.com>
Hi Fengnan,
Sorry for the delay.
I guess we can merge this patch, but let me check whether there
is another solution, since mm guys want to remove PG_error usage
to save one bit slot in page.flags.
On 2022/11/1 17:41, fengnan chang wrote:
> friendly ping...
>
> fengnan chang <fengnanchang@gmail.com> 于2022年10月14日周五 16:46写道:
>>
>> ping, it seems this had been forgotten.
>>
>>> 2022年6月8日 21:48,Fengnan Chang <fengnanchang@gmail.com> 写道:
>>>
>>> When decompressed failed, f2fs_prepare_compress_overwrite will enter
>>> endless loop, may casue hungtask.
>>>
>>> [ 14.088665] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
>>> [ 14.089851] F2FS-fs (nvme0n1): lz4 decompress failed, ret:-4155
>>>
>>> Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
>>> ---
>>> fs/f2fs/compress.c | 21 ++++++++++++++++-----
>>> 1 file changed, 16 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/fs/f2fs/compress.c b/fs/f2fs/compress.c
>>> index 24824cd96f36..1764e3859262 100644
>>> --- a/fs/f2fs/compress.c
>>> +++ b/fs/f2fs/compress.c
>>> @@ -1060,7 +1060,7 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>> sector_t last_block_in_bio;
>>> unsigned fgp_flag = FGP_LOCK | FGP_WRITE | FGP_CREAT;
>>> pgoff_t start_idx = start_idx_of_cluster(cc);
>>> - int i, ret;
>>> + int i, ret, retry_count = 3;
Wrap magic number w/ macro?
>>>
>>> retry:
>>> ret = f2fs_is_compressed_cluster(cc->inode, start_idx);
>>> @@ -1120,7 +1120,12 @@ static int prepare_compress_overwrite(struct compress_ctx *cc,
>>> f2fs_put_rpages(cc);
>>> f2fs_unlock_rpages(cc, i + 1);
>>> f2fs_destroy_compress_ctx(cc, true);
>>> - goto retry;
>>> + retry_count--;
>>> + if (PageError(page) && !retry_count) {
>>> + ret = -EIO;
>>> + goto out;
>>> + } else
>>> + goto retry;
} else {
goto retry;
}
>>> }
>>> }
>>>
>>> @@ -1657,10 +1662,16 @@ static void __f2fs_decompress_end_io(struct decompress_io_ctx *dic, bool failed)
>>> if (!rpage)
>>> continue;
>>>
>>> - /* PG_error was set if verity failed. */
>>> - if (failed || PageError(rpage)) {
>>> + if (failed) {
>>> + /* decompress page failed */
>>> + ClearPageUptodate(rpage);
>>> + SetPageError(rpage);
>>> + } else if (PageError(rpage)) {
>>> + /*
>>> + * PG_error was set if verity failed.
>>> + * will re-read again later.
>>> + */
>>> ClearPageUptodate(rpage);
>>> - /* will re-read again later */
>>> ClearPageError(rpage);
>>> } else {
>>> SetPageUptodate(rpage);
>>> --
>>> 2.25.1
>>>
>>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2022-11-01 15:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-08 13:48 [f2fs-dev] [PATCH v2] f2fs: fix hungtask when decompressed fail Fengnan Chang
2022-10-14 8:46 ` fengnan chang
2022-11-01 9:41 ` fengnan chang
2022-11-01 15:06 ` Chao Yu [this message]
2022-11-02 2:05 ` Eric Biggers
2022-11-02 3:06 ` fengnan chang
2022-11-02 3:18 ` Eric Biggers
2022-11-02 3:43 ` fengnan chang
2022-11-02 3:48 ` Eric Biggers
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=cae1e1e9-d528-496e-d89d-be47c4b8d0cb@kernel.org \
--to=chao@kernel.org \
--cc=fengnanchang@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/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