fuse: Fix EIO for writeback when DLM returns -EAGAIN#148
Closed
hbirth wants to merge 3 commits into
Closed
Conversation
5a51cf5 to
d1b1404
Compare
bsbernd
reviewed
May 1, 2026
bsbernd
reviewed
May 1, 2026
Fix a logical error where the DLM lock was acquired regardless of whether the writeback part was actually called. This is necessarry after the move to iomap_file_buffered_write() Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
d1b1404 to
c94b214
Compare
c94b214 to
a240f5c
Compare
bsbernd
reviewed
May 1, 2026
bsbernd
reviewed
May 1, 2026
1ab46be to
f1485f6
Compare
cding-ddn
reviewed
May 1, 2026
Collaborator
cding-ddn
left a comment
There was a problem hiding this comment.
fs/fuse/file.c.rej should not been added into the commit
The comment is incorrect to me.
We should not return EAGAIN to user space, but when the write return, it releases folio lock, why will it be an ABBA deadlock ?
f1485f6 to
449c9a4
Compare
fuse_do_readfolio() is called by fuse_iomap_read_folio_range() as well and is not supposed to return a positive value, thus the translation has to be done in another layer. Signed-off-by: Horst Birthelmer <hbirthelmer@ddn.com>
When FUSE server returns -EAGAIN during iomap write operations due to DLM lock contention, a deadlock can occur: 1. iomap write path holds folio lock and calls fuse_iomap_read_folio_range() 2. FUSE gets -EAGAIN from server (DLM lock conflict with page invalidation) 3. fuse_do_readfolio() converts -EAGAIN to AOP_TRUNCATED_PAGE 4. iomap doesn't understand AOP_TRUNCATED_PAGE and fails the write 5. Meanwhile page invalidation holds DLM lock and waits for folio lock 6. Result: ABBA deadlock This is a FUSE-only workaround until mainline iomap gains AOP_TRUNCATED_PAGE retry support. The solution: 1. Add per-task retry tracking in fuse_conn using xarray 2. When fuse_iomap_read_folio_range() sees AOP_TRUNCATED_PAGE: - Create retry entry for current task - Convert to -EAGAIN for iomap 3. In fuse_cache_write_iter(), after iomap returns error: - Check if retry entry exists for current task - If yes, erase it and retry the entire write operation This breaks the deadlock by allowing the folio lock to be released (per AOP_TRUNCATED_PAGE contract) and retrying at a higher level. Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
449c9a4 to
3ffe5e6
Compare
Collaborator
Author
yes I noticed ;-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are some small improvements that are only valid for kernel 6.17