[Cluster-devel] [RFC v2 0/3] Turn iomap_page_ops into iomap_folio_ops
Andreas Gruenbacher
agruenba at redhat.com
Thu Dec 1 18:09:54 UTC 2022
Hi again,
[Same thing, but with the patches split correctly this time.]
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
More information about the Cluster-devel
mailing list