Skip to content

fuse: don't leak AOP_TRUNCATED_PAGE from fuse_write_begin()#181

Merged
hbirth merged 1 commit into
redfs-ubuntu-noble-6.8.0-58.60from
redfs-ubuntu-noble-fix-truncated-page
Jun 11, 2026
Merged

fuse: don't leak AOP_TRUNCATED_PAGE from fuse_write_begin()#181
hbirth merged 1 commit into
redfs-ubuntu-noble-6.8.0-58.60from
redfs-ubuntu-noble-fix-truncated-page

Conversation

@hbirth

@hbirth hbirth commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

fuse_do_readpage() may return AOP_TRUNCATED_PAGE (a positive value) when the daemon fails its DLM lock acquisition with -EAGAIN during an in-flight invalidation. fuse_read_folio() is prepared for that, but fuse_write_begin() forwarded it to generic_perform_write(), which only treats negative returns as errors and went on to use the never-initialized page pointer: the user copy is silently fixed up as a 0-byte short copy and fuse_write_end() then oopses in unlock_page(NULL).

Retry the page grab and read inside fuse_write_begin() instead, mirroring the read-side retry done by filemap_fault().

Fixes: 8ecf118 ("fuse: Allow read_folio to retry page fault and read operations")

fuse_do_readpage() may return AOP_TRUNCATED_PAGE (a positive value)
when the daemon fails its DLM lock acquisition with -EAGAIN during an
in-flight invalidation. fuse_read_folio() is prepared for that, but
fuse_write_begin() forwarded it to generic_perform_write(), which only
treats negative returns as errors and went on to use the
never-initialized page pointer: the user copy is silently fixed up as
a 0-byte short copy and fuse_write_end() then oopses in
unlock_page(NULL).

Retry the page grab and read inside fuse_write_begin() instead,
mirroring the read-side retry done by filemap_fault().

Fixes: 8ecf118 ("fuse: Allow read_folio to retry page fault and read operations")

Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
@hbirth

hbirth commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

This is a quick and dirty reaction to the problem ... I think we have to fix this on the fuse server side

@hbirth hbirth requested review from bsbernd, cding-ddn and yongzech June 11, 2026 09:37
@hbirth hbirth merged commit b9389b9 into redfs-ubuntu-noble-6.8.0-58.60 Jun 11, 2026
2 checks passed
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.

2 participants