Andreas Gruenbacher 80baab88bb iomap/gfs2: Unlock and put folio in page_done handler
When an iomap defines a ->page_done() handler in its page_ops, delegate
unlocking the folio and putting the folio reference to that handler.

This allows to fix a race between journaled data writes and folio
writeback in gfs2: before this change, gfs2_iomap_page_done() was called
after unlocking the folio, so writeback could start writing back the
folio's buffers before they could be marked for writing to the journal.
Also, try_to_free_buffers() could free the buffers before
gfs2_iomap_page_done() was done adding the buffers to the current
current transaction.  With this change, gfs2_iomap_page_done() adds the
buffers to the current transaction while the folio is still locked, so
the problems described above can no longer occur.

The only current user of ->page_done() is gfs2, so other filesystems are
not affected.  To catch out any out-of-tree users, switch from a page to
a folio in ->page_done().

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
2023-01-18 10:44:04 -08:00
..
2022-10-19 12:55:42 +02:00
2022-10-19 12:55:42 +02:00
2019-07-03 14:45:18 +02:00
2021-06-29 10:56:51 +02:00
2022-08-06 14:44:49 -07:00
2022-12-17 08:18:04 -06:00
2022-05-09 23:12:33 -04:00
2022-08-11 13:11:49 -07:00
2022-08-03 10:35:43 -07:00
2022-09-11 20:26:06 -07:00
2022-02-02 07:49:59 -07:00