From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/2] f2fs: fix to use sb_{start, end}_intwrite{_trylock, }() in gc_thread_func()
Date: Wed, 19 Jun 2024 22:14:18 +0800 [thread overview]
Message-ID: <3c262735-accf-41a8-aa74-a96a7ae05945@kernel.org> (raw)
In-Reply-To: <20240606095213.4087668-2-chao@kernel.org>
On 2024/6/6 17:52, Chao Yu wrote:
> Since background GC is f2fs inner operation, so, let's use
> sb_{start,end}_intwrite{_trylock,}() instead of
> sb_{start,end}_write{_trylock,}() in gc_thread_func().
It may cause racing in between gc_thread and freeze_super(), result in
writeback of dirty page after ->freeze, so please ignore this patch.
- sb_wait_write(sb, SB_FREEZE_WRITE)
- sync_filesystem(sb)
- sb_start_intwrite_trylock
- f2fs_gc
: dirty pages
- sb_wait_write(sb, SB_FREEZE_FS)
Thanks,
>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/gc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
> index ef667fec9a12..004587ac5530 100644
> --- a/fs/f2fs/gc.c
> +++ b/fs/f2fs/gc.c
> @@ -76,7 +76,7 @@ static int gc_thread_func(void *data)
> f2fs_stop_checkpoint(sbi, false,
> STOP_CP_REASON_FAULT_INJECT);
>
> - if (!sb_start_write_trylock(sbi->sb)) {
> + if (!sb_start_intwrite_trylock(sbi->sb)) {
> stat_other_skip_bggc_count(sbi);
> continue;
> }
> @@ -163,7 +163,7 @@ static int gc_thread_func(void *data)
> }
> spin_unlock(&sbi->gc_remaining_trials_lock);
> }
> - sb_end_write(sbi->sb);
> + sb_end_intwrite(sbi->sb);
>
> } while (!kthread_should_stop());
> return 0;
_______________________________________________
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:[~2024-06-19 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 9:52 [f2fs-dev] [PATCH 1/2] f2fs: fix to add missing sb_{start, end}_intwrite() for ckpt thread Chao Yu
2024-06-06 9:52 ` [f2fs-dev] [PATCH 2/2] f2fs: fix to use sb_{start, end}_intwrite{_trylock, }() in gc_thread_func() Chao Yu
2024-06-19 14:14 ` Chao Yu [this message]
2024-06-08 12:34 ` [f2fs-dev] [PATCH 1/2] f2fs: fix to add missing sb_{start, end}_intwrite() for ckpt thread Chao Yu
2024-06-10 15:10 ` Daeho Jeong
2024-06-24 1:58 ` 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=3c262735-accf-41a8-aa74-a96a7ae05945@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).