Re: [f2fs-dev] [PATCH v3 2/2] f2fs: protect critical_task_priority updates with s_umount

Chao Yu via Linux-f2fs-devel <[email protected]> Tue, 4 Aug 2026 08:04:25 +0800
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/3/26 20:32, Wenjie Qi wrote:
> The sysfs store path already takes s_umount for GC thread control
> entries, and ckpt_thread_ioprio is covered as well.
> 
> critical_task_priority also updates checkpoint or GC kthread scheduling
> state, but it is not covered by that serialization. It can race with
> remount or teardown paths that are stopping those threads.
> 
> Protect critical_task_priority sysfs writes with s_umount too.
> 

Missing fixes and Cc stable line, otherwise it looks good to me.

> Signed-off-by: Wenjie Qi <[email protected]>
> ---
> v3:
> - split this change out so patch 1 only fixes ckpt_thread_ioprio
> - keep this patch focused on critical_task_priority only
> 
>   fs/f2fs/sysfs.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 0729b3670415..aa1621419932 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -1007,7 +1007,8 @@ static ssize_t f2fs_sbi_store(struct f2fs_attr *a,
>   	ssize_t ret;
>   	bool gc_entry = (!strcmp(a->attr.name, "gc_urgent") ||
>   					a->struct_type == GC_THREAD);
> -	bool thread_entry = !strcmp(a->attr.name, "ckpt_thread_ioprio");
> +	bool thread_entry = !strcmp(a->attr.name, "ckpt_thread_ioprio") ||
> +			!strcmp(a->attr.name, "critical_task_priority");
>   
>   	if (gc_entry || thread_entry) {
>   		if (!down_read_trylock(&sbi->sb->s_umount))



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel