Re: [f2fs-dev] [PATCH v1 07/12] f2fs: cache: use node cache

Wenjie Qi <[email protected]>
Newsgroups net.sourceforge.lists.linux-f2fs-devel,org.kernel.vger.linux-kernel
Message-ID <CAGFpFsSiP9_hDj-RgMV2+LZDX2qUquE7XBUP9eeV0ER8eLdgJw@mail.gmail.com>
Yes, that is the race I meant.

On Mon, Aug 24, 2026 at 3:13 PM Chao Yu <[email protected]> wrote:
>
> On 8/23/26 20:57, Wenjie Qi wrote:
> > Hi Chao,
> >
> >> entry = fn->entry;
> >> f2fs_cache_get(entry);
> >> spin_unlock_irqrestore(&sbi->fsync_node_lock, flags);
> >>
> >> f2fs_cache_wait_writeback(entry);
> >
> > The entry reference keeps the entry allocated, but the waiter does not hold
> > the entry lock.  After WRITEBACK is cleared, invalidation can detach the
> > entry and set `entry->cache` to NULL.  `f2fs_cache_wait_writeback()` checks
> > and uses `entry->cache` through separate accesses.
> >
> > Does the reference taken here also guarantee that the parent cache remains
> > attached across the wait helper's check and use?
>
> Do you mean race like this?
>
> - f2fs_wait_on_node_caches_writeback
>   - f2fs_cache_get
>   - f2fs_cache_wait_writeback
>    - checked entry->cache, it's valid
>                                                 - f2fs_truncate_cache
>                                                  - f2fs_do_truncate_cache
>                                                   - entry->cache = NULL
>    - f2fs_cache_wait_writeback_cond accesses
>      invalid entry->cache
>
> Thanks,


_______________________________________________
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.