Skip to content

[draft] Add fallible unmounting#648

Draft
khanhtranngoccva wants to merge 6 commits intocberner:masterfrom
khanhtranngoccva:blocking-2
Draft

[draft] Add fallible unmounting#648
khanhtranngoccva wants to merge 6 commits intocberner:masterfrom
khanhtranngoccva:blocking-2

Conversation

@khanhtranngoccva
Copy link
Contributor

@khanhtranngoccva khanhtranngoccva commented Feb 12, 2026

This serves as a more manageable version of #419. I cherry-picked the test cases and the CI modifier that allows these tests to execute. The tests cannot compile as of now, since the PR changed the API interface of umount_and_join.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d38e06509

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@@ -0,0 +1,148 @@
mod fixtures;

Choose a reason for hiding this comment

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

P1 Badge Add the fixtures module used by this integration test

The new test file declares mod fixtures;, which requires either tests/fixtures.rs or tests/fixtures/mod.rs, but this commit does not add either file. That causes the unmount integration test target to fail compilation with an unresolved module error before any test logic can run.

Useful? React with 👍 / 👎.

tests/unmount.rs Outdated
Comment on lines +39 to +41
let (session, error) = session
.umount_and_join(&[])
.expect_err("unmount should fail");

Choose a reason for hiding this comment

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

P1 Badge Update unmount calls to match current umount_and_join API

These tests still use the old umount_and_join contract (umount_and_join(&[]) and tuple-destructuring from expect_err), but in this commit BackgroundSession::umount_and_join takes no arguments and returns io::Result<()> (src/session.rs). This mismatch prevents the test file from compiling, so CI cannot execute the new unmount coverage.

Useful? React with 👍 / 👎.

@khanhtranngoccva khanhtranngoccva marked this pull request as draft February 12, 2026 03:07
@khanhtranngoccva khanhtranngoccva changed the title tests: write test for expected behavior of unmounting [draft] Add fallible unmounting Feb 12, 2026
@khanhtranngoccva
Copy link
Contributor Author

khanhtranngoccva commented Feb 23, 2026

@cberner I would like to ask if reintroducing the unmount behavior with user-specified flags so that the caller could recover the mount/session object and default to Detach flag otherwise is a good idea.

@cberner
Copy link
Owner

cberner commented Feb 23, 2026

No, I don't want to add any new unmount behavior, until there's a test that clearly shows what is wrong with the current behavior

@khanhtranngoccva
Copy link
Contributor Author

I modified the test cases to match the unmounting behavior specified, and modified CI to include testing as root. There are a few inconsistencies I've found so far:

  1. If AutoUnmount is enabled, dropping the unmount socket in fuse_pure does not cause the lazy unmount to work as intended. It causes the join thread to hang, and removing that would solve the issue.
  2. In fuse_pure, libc_umount runs first, and fuse_unmount_pure only runs as a fallback if the user is not root. These two implementations are not consistent - on Linux, libc_umount (as root) runs unmount calls without any flags, while fuse_unmount_pure (as non-root, since direct unmount calls do not work) always runs with detach/lazy.

@khanhtranngoccva
Copy link
Contributor Author

khanhtranngoccva commented Mar 3, 2026

@cberner Please let me know what behavior you want because currently, the unmounting behavior is non-deterministic and not well-defined in Linux.

As far as I know, the current libfuse3 implementations is also leaky and not well defined as mentioned by the previous PR(s), as it does not call fuse_session_destroy if on root.

@cberner
Copy link
Owner

cberner commented Mar 5, 2026

CI is failing, so I haven't looked at the test yet. Can you fix that? You can mark the new test #[ignore] or it's fine if that single test fails. But there are compilation issues right now

@khanhtranngoccva
Copy link
Contributor Author

CI is failing, so I haven't looked at the test yet. Can you fix that? You can mark the new test #[ignore] or it's fine if that single test fails. But there are compilation issues right now

The test is ready. I think that you should copy the CI commands and manually test them as root and as a normal user because these two cannot be tested at the same time in a single GitHub action (yet). In the future, the toggle whether to run as root or not can be put in a strategy matrix, but I don't have experience doing GitHub CI yet.

cargo test --all --features=libfuse,${{ matrix.features }}
cargo test --all --features=${{ matrix.features }}
cargo test --config "target.'cfg(test)'.runner = 'sudo -E'" --all --features=libfuse,${{ matrix.features }}
cargo test --config "target.'cfg(test)'.runner = 'sudo -E'" --all --features=${{ matrix.features }}

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