Re: [f2fs-dev] [PATCH v6] f2fs: protect gc task pointer during teardown

Cen Zhang <[email protected]>
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel
Message-ID <CAB7XQsETc1290AVo95JFzV6NEMr_Fyb5VrNWzH-5sF1Ldk+MvQ@mail.gmail.com>
Hi, Chao

Thanks a lot for your patient review and detailed suggestions.

> How about introduce f2fs_update_gc_task()?
>
> attach w/ f2fs_update_gc_task(, task), deattch w/ f2fs_update_gc_task(, NULL)?

I will introduce f2fs_update_gc_task(gc_th, task). The start path uses
f2fs_update_gc_task(gc_th, task), and the stop path uses
f2fs_update_gc_task(gc_th, NULL).

> +     if (READ_ONCE(gc_th->f2fs_gc_task))
> +             return 0;
>
> Why we need to check this?

Thanks, this check is unnecessary. I removed it.

> -     task = xchg(&gc_th->f2fs_gc_task, NULL);
>
> I don't see this line in anywhere.

Sorry, this came from my local prerequisite tree, I will rebase the
change onto right commit.

> +             if (!f2fs_cp_error(sbi) && READ_ONCE(gc_th->f2fs_gc_task)) {
>
> It's a corner case, I guess we can skip to check cp_error.

Agreed. I removed the added f2fs_cp_error() check and kept only the
f2fs_gc_task recheck after prepare_to_wait().

> Can we do like this?
>
> __sbi_store()
>
> spin_lock
> check f2fs_gc_task
> set_user_nice
> spin_unlock

Yes, will updated it this way.

I'll send v7 soon.

Thanks again.

Best regards,
Zhang Cen


_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.