Re: [PATCH 5.15] fuse: Fix race condition in writethrough path A race

Joanne Koong
2025-10-14T17:02:06Z

On Tue, Oct 14, 2025 at 5:43 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> On Tue, 14 Oct 2025 at 09:48, Miklos Szeredi <miklos@szeredi.hu> wrote:
>
> > Maybe the solution is to change the write-through to regular cached
> > write + fsync range? That could even be a complexity reduction.
>
> While this would be nice, it's impossible to guarantee requests being
> initiated in the context of the original write(2), which means that
> the information about which open file it originated from might be
> lost. This could result in regressions, so I don't think we should
> risk it.
>
> Will try the idea of marking folios writeback for the duration of the write.
>

Is it safe to mark a folio as being under writeback if it doesn't
actually go through mm writeback? for example, my understanding is
that the inode wb mechanisms get initiated when an inode is marked
dirty (__mark_inode_dirty()) but writethrough skips any dirtying.
Afaict, folio_start_writeback()/folio_end_write() needs i_wb.
Additionally, if the server page faults on the folio that is now
marked as under writeback, does that lead to a deadlock since
page_mkwrite() waits on folio writeback?

Thanks,
Joanne

> Thanks,
> Miklos