linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iomap: small block problems
@ 2021-06-28 17:27 Andreas Gruenbacher
  2021-06-28 17:27 ` [PATCH 1/2] iomap: Don't create iomap_page objects for inline files Andreas Gruenbacher
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Andreas Gruenbacher @ 2021-06-28 17:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Darrick J . Wong, linux-xfs, linux-fsdevel, cluster-devel,
	Andreas Gruenbacher

Hi Christoph and all,

the recent gfs2 switch from buffer heads to iomap for managing the
block-to-page mappings in commit 2164f9b91869 ("gfs2: use iomap for
buffered I/O in ordered and writeback mode") broke filesystems with a
block size smaller than the page size.  This haüüens when iomap_page
objects aren't attached to pages in all the right circumstances, or the
iop->upodate bitmap isn't kept in sync with the PageUptodata flag.
There are three instances of this problem:

(1) In iomap_readpage_actor, an iomap_page is attached to the page even
for inline inodes.  This is unnecessary because inline inodes don't need
iomap_page objects.  That alone wouldn't cause any real issues, but when
iomap_read_inline_data copies the inline data into the page, it sets the
PageUptodate flag without setting iop->uptodate, causing an
inconsistency between the two.  This will trigger a WARN_ON in
iomap_page_release.  The fix should be not to allocate iomap_page
objects when reading from inline inodes (patch 1).

(2) When un-inlining an inode, we must allocate a page with an attached
iomap_page object (iomap_page_create) and initialize the iop->uptodate
bitmap (iomap_set_range_uptodate).  We can't currently do that because
iomap_page_create and iomap_set_range_uptodate are not exported.  That
could be fixed by exporting those functions, or by implementing an
additional helper as in patch 2.  Which of the two would you prefer?

(3) We're not yet using iomap_page_mkwrite, so iomap_page objects don't
get created on .page_mkwrite, either.  Part of the reason is that
iomap_page_mkwrite locks the page and then calls into the filesystem for
uninlining and for allocating backing blocks.  This conflicts with the
gfs2 locking order: on gfs2, transactions must be started before locking
any pages.  We can fix that by calling iomap_page_create from
gfs2_page_mkwrite, or by doing the uninlining and allocations before
calling iomap_page_mkwrite.  I've implemented option 2 for now; see
here:

https://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git/log/?h=for-next.iomap-page-mkwrite

Any thoughts?

Thanks,
Andreas

Andreas Gruenbacher (1):
  iomap: Don't create iomap_page objects for inline files

Bob Peterson (1):
  iomap: Add helper for un-inlining an inline inode

 fs/iomap/buffered-io.c | 28 +++++++++++++++++++++++++++-
 include/linux/iomap.h  |  2 ++
 2 files changed, 29 insertions(+), 1 deletion(-)

-- 
2.26.3


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

end of thread, other threads:[~2021-07-05 16:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-28 17:27 [PATCH 0/2] iomap: small block problems Andreas Gruenbacher
2021-06-28 17:27 ` [PATCH 1/2] iomap: Don't create iomap_page objects for inline files Andreas Gruenbacher
2021-06-30 13:35   ` Matthew Wilcox
2021-06-28 17:27 ` [PATCH 2/2] iomap: Add helper for un-inlining an inline inode Andreas Gruenbacher
2021-06-28 17:39 ` [PATCH 0/2] iomap: small block problems Matthew Wilcox
2021-06-28 17:47   ` Christoph Hellwig
2021-06-28 21:28     ` Andreas Gruenbacher
2021-06-28 21:59     ` Matthew Wilcox
2021-06-29  5:29       ` Christoph Hellwig
2021-06-29  5:42         ` Christoph Hellwig
2021-06-30 12:29         ` Andreas Gruenbacher
2021-07-05 15:51           ` Andreas Gruenbacher
2021-07-05 16:55             ` Christoph Hellwig
2021-06-28 17:55   ` Andreas Gruenbacher
2021-06-29  9:12 ` Andreas Gruenbacher
2021-06-30 14:08   ` Matthew Wilcox
2021-06-30 14:45     ` Andreas Gruenbacher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).