Skip to content

restore FUSE reconnection after suspend and resume#283

Merged
andylemin merged 11 commits into
mainfrom
fuse-resume-fix
Jul 7, 2026
Merged

restore FUSE reconnection after suspend and resume#283
andylemin merged 11 commits into
mainfrom
fuse-resume-fix

Conversation

@rdmark

@rdmark rdmark commented Jul 5, 2026

Copy link
Copy Markdown
Member

The FUSE suspend/resume operations got broken when we hardened AFP session reconnection recently.

Keep a per-mount FUSE reconnect credential after the initial authenticated login, since the shared AFP server password cache is scrubbed for stateless session safety and resume commands do not carry a fresh password.

Make DSI attention handling generation-aware by copying packets into the worker context and ignoring stale attentions from older connections before they can disconnect a newly resumed socket.

Also register FPZzzzz as a blank-reply AFP command and initialize FUSE reconnect error reporting so suspend and resume diagnostics reflect real failures.

introduce explicit suspended flag for FUSE mounts: before, any file system operation on a suspended mount would reactivate it, but now only an explicit 'resume' command will cause it to wake up

Add FUSE client tests for suspend and resume, while improving the resilience, configurability, and documentation of the FUSE test runner.

Make a number of adjacent improvements and bug fixes:

  • prevent double free during FUSE3 unmount process and handle SIGPIPE wakeups safely
  • force FUSE demon foreground mode when using stdout log method
  • make DSI connection generation access atomic

@rdmark rdmark requested a review from andylemin as a code owner July 5, 2026 06:30
Comment thread .github/workflows/test.yml Fixed
@augmentcode

augmentcode Bot commented Jul 5, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR fixes regressions in FUSE suspend/resume reconnects introduced by recent AFP reconnect hardening.

Changes:

  • Initialize reconnect error reporting buffers correctly so failures surface as meaningful messages.
  • Persist a per-mount reconnect password after initial login so resume can reconnect even when shared caches are scrubbed.
  • Make DSI attention handling reconnect-safe by copying attention packets into a per-thread context and filtering stale packets using a connection generation counter.
  • Register FPZzzzz as a blank-reply AFP command and add a stronger FUSE suspend/resume regression test (including optional debug logging).

Technical Notes: Connection generation updates/reads are now atomic helpers, and attention threads release server refs safely after stale-generation checks.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread lib/dsi.c Outdated
Comment thread test/test_fuse.t Outdated
@rdmark rdmark force-pushed the fuse-resume-fix branch from 7405e33 to b2fdb9e Compare July 5, 2026 12:50
rdmark added 2 commits July 5, 2026 15:25
The FUSE suspend/resume operations got broken when we hardened AFP session
reconnection recently.

Keep a per-mount FUSE reconnect credential after the initial authenticated
login, since the shared AFP server password cache is scrubbed for stateless
session safety and resume commands do not carry a fresh password.

Make DSI attention handling generation-aware by copying packets into the
worker context and ignoring stale attentions from older connections before
they can disconnect a newly resumed socket.

Also register FPZzzzz as a blank-reply AFP command and initialize FUSE
reconnect error reporting so suspend and resume diagnostics reflect real
failures.
@rdmark rdmark force-pushed the fuse-resume-fix branch from b2fdb9e to a6b236f Compare July 5, 2026 13:25
@rdmark

rdmark commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

augment review

@rdmark rdmark changed the title restore FUSE suspend resume reconnects restore FUSE reconnection after suspend and resume Jul 5, 2026

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread fuse/daemon.c
rdmark added 5 commits July 5, 2026 15:53
Install an explicit SIGPIPE handler in afpfsd before any FUSE mount thread
can run so pthread_kill(SIGPIPE) cannot terminate the daemon if libfuse
has not installed its own handler yet.

Keep using SIGPIPE only as the documented libfuse wakeup after fuse_exit(),
allowing the FUSE thread's fuse_main() path to own unmount and session cleanup.
Add helper accessors for the AFP server connection generation counter
and use them anywhere DSI snapshots or compares the value.

This removes the data race between reconnect generation increments and
detached attention handling, keeping stale-attention and stale-reply
filtering reliable across reconnects.
@rdmark rdmark force-pushed the fuse-resume-fix branch from a6b236f to 03a255a Compare July 5, 2026 13:55
@rdmark

rdmark commented Jul 5, 2026

Copy link
Copy Markdown
Member Author

@andylemin with this changeset, it should be easier and more consistent to run the FUSE tests locally

prepare the environment as described in test/TESTS.md and invoke it like this

AFP_FUSE_DEBUG_LOG=/tmp/test_fuse-afpfsd.log prove test_fuse.t :: --user *** --password ***

I have attempted several times to create a CI job for the FUSE tests, but I'm pretty sure this is where we'd have to create our own self hosted runner to make it happen

rdmark added 4 commits July 5, 2026 22:36
before, any file system operation on a suspended mount would reactivate it,
but now only an explicit 'resume' command will cause it to wake up
on macOS we have to call umount directly, and cannot rely on
afp_client unmount
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

@andylemin

Copy link
Copy Markdown
Contributor

Lots of great UX improvements

@andylemin andylemin merged commit ee6848f into main Jul 7, 2026
20 checks passed
@rdmark rdmark deleted the fuse-resume-fix branch July 7, 2026 04:40
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.

3 participants