Skip to content

6.17 Fix the fencing around readahead to not clash with an invalidation notification - #208

Open
hbirth wants to merge 7 commits into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hbirth:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1
Open

6.17 Fix the fencing around readahead to not clash with an invalidation notification#208
hbirth wants to merge 7 commits into
DDNStorage:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1from
hbirth:redfs-ubuntu-hwe-6.17.0-16.16-24.04.1

Conversation

@hbirth

@hbirth hbirth commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

and various other small fixes and code simplifications like explicit exclusion of dlm from O_DIRECT opened files.

A folio made uptodate from the server is served to every later reader,
so the grant it was fetched under has to be held from the confirmation
until the bytes are in the page cache.  Without that a revoke sweeping
the range leaves the fill behind it: the folio stays cached, uncovered,
and the server sends no further notify for a lock this client no longer
holds.

Confirm the grant under a pin, as the write path does.  Refused, or not
covered, unlock the folio and back off with AOP_TRUNCATED_PAGE: neither
the wait nor the grant request may be taken with a page lock held.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
A readahead reply lands in the page cache from the task that processes
it, so the pin over the folios has to span the request: taken before it
is sent and dropped once the folios are filled and unlocked.  A revoke
of the range waits for that and drops the folios after; one already
draining refuses the pin and the window goes back unfilled.

The node therefore outlives the pinning task, which fuse_dlm_unpin()
cannot express.  Add a span-owned pin, dropped by node and carrying no
owner for the by-owner search to match.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
A read grant may not be requested under a page lock, so every buffered
read path asks for one before it enters the page cache: buffered read,
splice read and read fault.  The window covers what readahead may add
beyond the read, bounded by the file.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
->readahead runs with every folio of the window locked, so the grant
request it sent went out under those locks and a revoke of the window
had to be given up on.  The read now takes the grant before the page
cache is entered; fill only what it covers.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
POSIX_FADV_WILLNEED and readahead(2) fill through ->readahead, which now
fills only what a grant already covers.  Take the grant for the advised
range first, with no folio held.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
A streamed write goes to the server out of the caller's pages, so its
bytes are in no page cache and a revoke of the range finds nothing to
flush.  Hold the grant across the FUSE_WRITE, as the writethrough edges
do.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
An O_DIRECT read or write neither fills nor dirties the page cache, so a
grant over its range covers nothing and only conflicts with the rest of
the cluster.  Skip it on both sides.

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
@hbirth hbirth changed the title Fix the fencing around readahead to not clash with a invalidation notification Fix the fencing around readahead to not clash with an invalidation notification Sep 4, 2026
@hbirth hbirth changed the title Fix the fencing around readahead to not clash with an invalidation notification 6.17 Fix the fencing around readahead to not clash with an invalidation notification Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant