netfs: Fix folio unmarking/unlocking loops
Hi Linus,
Could you pull these changes please? There are two, affecting the functions that iterates over the pagecache unmarking or unlocking pages after an op is complete:
(1) xas_for_each() loops must call xas_retry() first thing and immediately do a "continue" in the case that the extracted value is a special value that indicates that the walk raced with a modification. Fix the unlock and unmark loops to do this.
(2) The maths in the unlock loop is dodgy as it could, theoretically, at some point in the future end up with a starting file pointer that is in the middle of a folio. This will cause a subtraction to go negative - but the number is unsigned. Fix the maths to use absolute file positions instead of relative page indices.
Thanks,
David
---
The following changes since commit f0c4d9fc9cc9462659728d168387191387e903cc:
Linux 6.1-rc4 (2022-11-06 15:07:11 -0800)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git tags/netfs-fixes-20221115
for you to fetch changes up to 5e51c627c5acbcf82bb552e17533a79d2a6a2600:
netfs: Fix dodgy maths (2022-11-15 16:56:07 +0000)
----------------------------------------------------------------
netfslib fixes
----------------------------------------------------------------
David Howells (2):
netfs: Fix missing xas_retry() calls in xarray iteration
netfs: Fix dodgy maths
fs/netfs/buffered_read.c | 20 +++++++++++++------- fs/netfs/io.c | 3 +++ 2 files changed, 16 insertions(+), 7 deletions(-)
The pull request you sent on Tue, 15 Nov 2022 21:19:29 +0000:
The pull request you sent on Tue, 15 Nov 2022 21:19:29 +0000:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.gittags/netfs-fixes-20221115
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/59d0d52c30d4991ac4b329f049cc37118e00f5b0
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html