iomap: wait for batched folios to be stable in __iomap_get_folio
Subsystems (2)
PATCH 1/1 iomap: wait for batched folios to be stable in __iomap_get_folio
__iomap_get_folio needs to wait for writeback to finish if the file requires folios to be stable for writes. For the regular path this is taken care of by __filemap_get_folio, but for the newly added batch lookup it has to be done manually.
This fixes xfs/131 failures when running on PI-capable hardware.
--- fs/iomap/buffered-io.c | 1 + 1 file changed, 1 insertion(+)
fs/iomap/buffered-io.c +1 -0
@@ -851,6 +851,7 @@ static struct folio *__iomap_get_folio(struct iomap_iter *iter, }folio_get (folio); +folio_wait_stable (folio);return folio; }
Signature · 1 line
2.47.3
Quoted 18 lines · Christoph Hellwig
__iomap_get_folioneeds to wait for writeback to finish if the file requires folios to be stable for writes. For the regular path this is taken care of by__filemap_get_folio, but for the newly added batch lookup it has to be done manually.This fixes xfs/131 failures when running on PI-capable hardware.
Fixes 395ed1ef0012 ("iomap: optional zero range dirty folio processing")Signed-off-by Christoph Hellwig <[email protected]>--- fs/iomap/buffered-io.c | 1 + 1 file changed, 1 insertion(+)fs/iomap/buffered-io.c +0
-0
fs/iomap/buffered-io.c static struct folio *__iomap_get_folio(struct iomap_iter *iter, · line 854
Quoted 4 lines
fs/iomap/buffered-io.c +1
-0@@ -851,6 +851,7 @@ static struct folio *__iomap_get_folio(struct iomap_iter *iter, }folio_get (folio); +folio_wait_stable (folio);
Heh, oops. That's a little too easy to miss. :(
I wonder if we ought to have a filemap_fbatch_next() that would take care of the relocking, revalidation, and stabilization... but this spot fix is good as-is.
--D
Quoted 6 lines
fs/iomap/buffered-io.c +0
-0return folio; }Signature · 1 line
2.47.3
Quoted 3 lines · Darrick J. Wong
I wonder if we ought to have a
filemap_fbatch_next()that would take care of the relocking, revalidation, and stabilization... but this spot fix is good as-is.
Let's wait until we have another user or two. Premature refactoring tends to backfire.
Quoted 8 lines · Christoph Hellwig
Quoted 3 lines · Darrick J. Wong
I wonder if we ought to have a
filemap_fbatch_next()that would take care of the relocking, revalidation, and stabilization... but this spot fix is good as-is.Let's wait until we have another user or two. Premature refactoring tends to backfire.
I agree on not being too aggressive on that... I do like the idea though, so I'll try to keep it in mind if this happens to expand down the road. Thanks for the fix.
Brian
Quoted 6 lines · Brian Foster
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines · Darrick J. Wong
I wonder if we ought to have a
filemap_fbatch_next()that would take care of the relocking, revalidation, and stabilization... but this spot fix is good as-is.
Quoted 7 lines
Quoted 3 lines
Let's wait until we have another user or two. Premature refactoring tends to backfire.
I agree on not being too aggressive on that... I do like the idea though, so I'll try to keep it in mind if this happens to expand down the road. Thanks for the fix.
<nod> Making the second user do the refactoring is ok with me. :)
--D
Quoted 3 lines
Brian
Quoted 10 lines · Christoph Hellwig
__iomap_get_folioneeds to wait for writeback to finish if the file requires folios to be stable for writes. For the regular path this is taken care of by__filemap_get_folio, but for the newly added batch lookup it has to be done manually.This fixes xfs/131 failures when running on PI-capable hardware.
Fixes 395ed1ef0012 ("iomap: optional zero range dirty folio processing")Signed-off-by Christoph Hellwig <[email protected]>---
Quoted 19 lines
fs/iomap/buffered-io.c | 1 + 1 file changed, 1 insertion(+)fs/iomap/buffered-io.c +1
-0@@ -851,6 +851,7 @@ static struct folio *__iomap_get_folio(struct iomap_iter *iter, }folio_get (folio); +folio_wait_stable (folio);return folio; }Signature · 1 line
2.47.3
Quoted 8 lines · Christoph Hellwig
__iomap_get_folioneeds to wait for writeback to finish if the file requires folios to be stable for writes. For the regular path this is taken care of by__filemap_get_folio, but for the newly added batch lookup it has to be done manually.This fixes xfs/131 failures when running on PI-capable hardware.
[...]
Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs.fixes
[1/1] iomap: wait for batched folios to be stable in __iomap_get_folio
https://git.kernel.org/vfs/vfs/c/561940a7ee81