All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/3] Turn iomap_page_ops into iomap_folio_ops
@ 2022-12-01 16:06 ` Andreas Gruenbacher
  0 siblings, 0 replies; 22+ messages in thread
From: Andreas Gruenbacher @ 2022-12-01 16:06 UTC (permalink / raw)
  To: Christoph Hellwig, Darrick J . Wong, Alexander Viro, Matthew Wilcox
  Cc: Andreas Gruenbacher, linux-xfs, linux-fsdevel, linux-ext4, cluster-devel

Hello,

we're seeing a race between journaled data writes and the shrinker on
gfs2.  What's happening is that gfs2_iomap_page_done() is called after
the page has been unlocked, so try_to_free_buffers() can come in and
free the buffers while gfs2_iomap_page_done() is trying to add them to
the transaction.  Not good.

This is a proposal to change iomap_page_ops so that page_prepare()
prepares the write and grabs the locked page, and page_done() unlocks
and puts that page again.  While at it, this also converts the hooks
from pages to folios.

To move the pagecache_isize_extended() call in iomap_write_end() out of
the way, a new folio_may_straddle_isize() helper is introduced that
takes a locked folio.  That is then used when the inode size is updated,
before the folio is unlocked.

I've also converted the other applicable folio_may_straddle_isize()
users, namely generic_write_end(), ext4_write_end(), and
ext4_journalled_write_end().

Any thoughts?

Thanks,
Andreas

Andreas Gruenbacher (3):
  fs: Add folio_may_straddle_isize helper
  iomap: Turn iomap_page_ops into iomap_folio_ops
  gfs2: Fix race between shrinker and gfs2_iomap_folio_done

 fs/buffer.c            |  5 ++---
 fs/ext4/inode.c        | 13 +++++------
 fs/gfs2/bmap.c         | 39 +++++++++++++++++++++++---------
 fs/iomap/buffered-io.c | 51 +++++++++++++++++++++---------------------
 include/linux/iomap.h  | 24 ++++++++++----------
 include/linux/mm.h     |  2 ++
 mm/truncate.c          | 34 ++++++++++++++++++++++++++++
 7 files changed, 110 insertions(+), 58 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2022-12-05 23:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 16:06 [RFC 0/3] Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 16:06 ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 16:06 ` [RFC 1/3] fs: Add folio_may_straddle_isize helper Andreas Gruenbacher
2022-12-01 16:06   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 16:06 ` [RFC 2/3] iomap: Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 16:06   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 16:06 ` [RFC 3/3] gfs2: Fix race between shrinker and gfs2_iomap_folio_done Andreas Gruenbacher
2022-12-01 16:06   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 18:09 ` [RFC v2 0/3] Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 18:09   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 21:29   ` Dave Chinner
2022-12-01 21:29     ` [Cluster-devel] " Dave Chinner
2022-12-02  1:54     ` Andreas Gruenbacher
2022-12-02  1:54       ` [Cluster-devel] " Andreas Gruenbacher
2022-12-05 23:04       ` Dave Chinner
2022-12-05 23:04         ` [Cluster-devel] " Dave Chinner
2022-12-01 18:09 ` [RFC v2 1/3] fs: Add folio_may_straddle_isize helper Andreas Gruenbacher
2022-12-01 18:09   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 18:09 ` [RFC v2 2/3] iomap: Turn iomap_page_ops into iomap_folio_ops Andreas Gruenbacher
2022-12-01 18:09   ` [Cluster-devel] " Andreas Gruenbacher
2022-12-01 18:09 ` [RFC v2 3/3] gfs2: Fix race between shrinker and gfs2_iomap_folio_done Andreas Gruenbacher
2022-12-01 18:09   ` [Cluster-devel] " Andreas Gruenbacher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.