Skip to content

fix(fs): finish operations whose FUSE request is interrupted - #45

Merged
mattmattox merged 11 commits into
mainfrom
fix/eintr-on-interrupt
Nov 10, 2026
Merged

mattmattox merged 11 commits into
mainfrom
fix/eintr-on-interrupt

Conversation

@mattmattox

@mattmattox mattmattox commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

FUSE handlers that pass their context on now run on context.WithoutCancel(ctx). A signal to the calling process (for Go programs, the runtime's preemption SIGURG) no longer cancels the request context. On main, lock.Acquire still ends its wait when the context is cancelled, so that signal turned ordinary creates and writes into EIO. Lock waits are still bounded: #54 gives up after 30s (DefaultTimeout) and logs the lock and its holder at WARN, and the op then fails with EIO.

I didn't return EINTR, and the PM approved that. Create commits its journal intent before its first lock wait, so an EINTR would need intent rollback. Retries of unlink, rmdir and O_EXCL create fail (ENOENT, EEXIST) once the first attempt is past its point of no return. C programs rarely retry EINTR. go-fuse documents honoring an interrupt as optional. OPERATIONS.md and TROUBLESHOOTING.md now say file operations ignore interrupts like an NFS hard mount, that SIGKILL still works, and that a stuck lock wait fails with EIO after 30s with a [WARN] lock: gave up waiting line naming the holder.

Tests:

  • TestWriteFinishesAfterInterruptDuringLockWait (unit, two in-process nodes): fails on 409a89f, where Write returned EIO.
  • TestMultiNodeCreateWithSignals (tgkill SIGURG to the creating threads): fails on 409a89f, with EIO in 3 of 3 runs.
  • TestWriteFailsWhenLockIsNotFreed (unit): node A keeps a busy hold, and node B's interrupted Write returns EIO after about 31s.

Tested on .68 at 8248fd9:

  • Lint: 0 issues.
  • Unit tests pass.
  • The signal test passed 3 of 3.
  • -short integration: 118 pass, 18 skip, 0 fail.
  • TestMultiNodeConcurrentDirectoryOps passed 50 of 50, at ee01dbc.

🤖 Generated with Claude Code

mattmattox and others added 6 commits October 24, 2026 18:40
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The kernel sends FUSE_INTERRUPT whenever the calling process gets a
signal, and Go programs signal themselves for preemption all the time.
go-fuse cancels the request context, lock.Acquire gives up, and the
operation returned EIO, after side effects such as a committed journal
intent. Every FUSE handler now runs on a context that interrupts do not
cancel, so the operation finishes. Honoring an interrupt with EINTR
would need rollback of partial work, breaks retries of unlink, rmdir
and O_EXCL create, and C programs rarely retry it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
File operations ignore interrupts like an NFS hard mount; a lock wait that cannot finish fails with EIO after DefaultTimeout (from #29).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Statfs, Getattr, Open, Read and Fsync never use their context, so they cannot wait on a lock; ineffassign flagged the dead assignment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox and others added 3 commits November 10, 2026 15:15
Needs #29: on main a lock wait has no time limit, so this test hangs.
Merge it into #45 once #29 is on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mattmattox added a commit that referenced this pull request Nov 10, 2026
)

Acquire ended a wait only when the caller's context was done. A FUSE handler
that detaches its context from request interrupts (#45) would then wait
forever on a lock that is never released. Acquire now also gives up after
DefaultTimeout (30s), and logs at WARN the lock key and the record's holder,
mode and age, so operators can see which node held it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 55ca3cd into main Nov 10, 2026
10 checks passed
mattmattox added a commit that referenced this pull request Nov 13, 2026
Since #45 an interrupted FUSE create finishes instead of failing with
EIO, so TestMultiNodeConcurrentCreatesDoNotCollide no longer needs its
EIO retry. It now also checks that each node reads every file the
other node created, with the right content.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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