[GIT PULL] Two folio fixes for 5.18

From: Matthew Wilcox
Date: Thu May 05 2022 - 19:43:32 EST


Darrick and Brian have done amazing work debugging the race I created
in the folio BIO iterator. The readahead problem was deterministic,
so easy to fix.

The following changes since commit a7391ad3572431a354c927cf8896e86e50d7d0bf:

Merge tag 'iomm-fixes-v5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu (2022-05-04 11:04:52 -0700)

are available in the Git repository at:

git://git.infradead.org/users/willy/pagecache.git tags/folio-5.18f

for you to fetch changes up to b9ff43dd27434dbd850b908e2e0e1f6e794efd9b:

mm/readahead: Fix readahead with large folios (2022-05-05 00:47:29 -0400)

----------------------------------------------------------------
Two folio fixes for 5.18:

- Fix a race when we were calling folio_next() in the BIO folio iter
without holding a reference, meaning the folio could be split or freed,
and we'd jump to the next page instead of the intended next folio.

- Fix readahead creating single-page folios instead of the intended
large folios when doing reads that are not a power of two in size.

----------------------------------------------------------------
Matthew Wilcox (Oracle) (2):
block: Do not call folio_next() on an unreferenced folio
mm/readahead: Fix readahead with large folios

include/linux/bio.h | 5 ++++-
mm/readahead.c | 15 +++++++++------
2 files changed, 13 insertions(+), 7 deletions(-)