On Fri, Oct 18, 2024 at 3:54 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > > On Fri, 4 Oct 2024 at 21:04, Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > > > The warning is complaining about this WARN_ON here > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/fuse/file.c#n1989. > > > I think this warning can get triggered if there's a race between a > > > write() and a close() where the page is dirty in the cache after the > > > release has happened. Then when writeback (eg fuse_writepages()) is > > > triggered, we hit this warning. (this possibility has always existed, > > > it was surfaced after this refactoring commit 4046d3adcca4: "move fuse > > > file initialization to wpa allocation time" but the actual logic > > > hasn't been changed). > > > > Actually, it's not clear how this WARN_ON is getting triggered. > > > > I will wait for syzbot to surface a repro first before taking further action. > > I think the issue is that fuse_writepages() might be called with no > dirty pages after all writable opens were closed. The exact mechanism > is unclear, but it's pretty likely that this is the case. > > Commit 672c3b7457fc ("fuse: move initialization of fuse_file to > fuse_writepages() instead of in callback") broke this case. > > Maybe reverting this is the simplest fix? Reverting this sounds good to me. I guess we don't run into this warning in the original code because if there are no dirty pages, write_cache_pages() calls into folio_prepare_writeback() which skips the folio if it's not dirty. Thanks, Joanne > > Thanks, > Miklos