On Fri, Dec 23, 2022 at 09:54:34PM +0100, Andreas Grünbacher wrote: > > But for the current version I don't really understand why the error > > unwinding changes here. > > Currently, we have this order of operations in iomap_write_begin(): > > folio_unlock() // folio_put() // iomap_write_failed() // ->page_done() > > and this order in iomap_write_end(): > > folio_unlock() // ->page_done() // folio_put() // iomap_write_failed() > > The unwinding in iomap_write_begin() works because this is the trivial > case in which nothing happens to the page. We might just as well use > the same order of operations there as in iomap_write_end() though, and > when you switch to that, this is what you get. Please document this in the commit message.