Re: [PATCH] filemap: Handle error return from __filemap_get_folio()

Christoph Hellwig
2023-05-09T20:49:20Z

On Tue, May 09, 2023 at 10:37:12AM -0700, Linus Torvalds wrote:
> In fs/btrfs/extent_io.c, we have
>
> while (index <= end_index) {
> folio = filemap_get_folio(mapping, index);
> filemap_dirty_folio(mapping, folio);
>
> and in fs/gfs2/lops.c we have a similar case of filemap_get_folio ->
> folio_wait_locked use without checking for any errors.
>
> I assume it's probably hard to trigger errors in those paths, but it
> does look dodgy.

The pages are pinned at the point. That being said this code is
absolutely for many other reasons and needs to go away. I've been
looking into it, but it will probably take several more months to
unpile the onion to get to the hear of the btrfs writeback code
problems..