Repository navigation
Conversation
fuser calls every Filesystem method on its own session thread, which belongs to no Tokio runtime. The listing, read and size helpers looked the runtime up with Handle::current(), so the first directory listing panicked that thread and the mount answered ls with an I/O error or hung. The daemon now passes its runtime handle to FusePresenter, which hands it to FuseOps, and the helpers block on that handle. A crate-level clippy.toml disallows Handle::current and try_current in presenter-fuse so the class cannot return. A unit test calls each helper from a plain thread while a runtime exists elsewhere, as fuser does. Fixes #99
lookup answered every file with size zero, on the assumption that the kernel would ask getattr for the real one. The kernel bounds page-cache reads by the size in the last LOOKUP or GETATTR reply and refreshes an expired entry with LOOKUP alone, so every read through the mount returned no data. lookup and getattr now build file attributes through one helper that takes the size from the owning backend's metadata.
Tier 3 ran ls on the mount with || true, so a mount that answered the listing with an I/O error still passed. It now lists the backend's directory, checks the seeded file is there and reads it back, each under a timeout so a hung mount fails the step instead of the job timing out.
merge_listing dropped the size the backend listed, so a presenter that needed it had to make a metadata call per entry, which for Google Drive walks the whole path. DirEntry now has size: Option<u64>, None for directories and for files with no byte size, such as native Google documents.
lookup and getattr turned a failed metadata call, or a file with no size, into size zero, so the kernel read it as empty and cp copied an empty file and reported success. Both now take the size from the parent's listing and answer EIO when it is unknown or the listing fails; lookup no longer makes a metadata call. A kernel read downloaded the whole file each time. Reads now go to the backend's read_range with the FileEntry the listing returned. Every backend call on fuser's session thread is bounded by BACKEND_CALL_TIMEOUT, so one stalled request fails with EIO instead of leaving the whole mount unanswered.
list_children matched child paths with LIKE, which treats _ and % as wildcards and ignores ASCII case, so listing a_b also returned the children of axb and A_B. The prefix is now compared byte for byte.
The limiter started with 10,000 tokens and only a test ever refilled it, so after 10,000 requests every Drive call waited forever. Tokens are now regained from the time elapsed since the last refill, at the limiter's configured rate per 100 seconds.
The read cache kept the last of several same-named entries while lookup and getattr took the first, so a read could serve one file's bytes at another's size. A listing now keeps one entry per name, the one with the smallest ItemId, so every handler resolves the name the same way. Each listing replaces its directory's cached entries, so a removed file can no longer be read, and readdir reports a failed listing as EIO rather than ENOTDIR. The comments on size: None named Google Docs files; Drive gives those a size and leaves it unset for shortcuts and folders.
Opening a directory resolved its path again through the backend, which could pick a different same-named entry than the parent's listing kept, or a file, so a folder listed empty or showed another folder. The FUSE listing now records every entry it keeps and lists a directory by that entry's native id; only a backend root is listed by its root id.
S3Backend has no list_children and inherits the empty default, so a FUSE mount of an S3 backend showed every folder as empty and looked healthy. Backend::lists_children now says whether a listing is real; S3 says it is not, and the FUSE listing fails with an error naming the backend, so the mount answers EIO and logs why. Only the FUSE mount reads the new flag. S3 list_children is unchanged, so no other presenter and no delete, move, copy or upload path changes.
This was referenced Dec 1, 2026
Mearman
marked this pull request as ready for review
December 1, 2026 16:57
This branch has not been deployed
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.
The Linux FUSE mount panicked on its first listing (#99): fuser calls every
Filesystemmethod on its own session thread, which belongs to no Tokio runtime, andread_dir_sync,read_syncandmetadata_size_synccalledHandle::current()there. This is the read-only part of #100, rebuilt on main: what a mount needs to list, stat and read correctly, and nothing that writes.FusePresenterandFuseOps, and the helpers block on it.crates/presenter-fuse/clippy.tomldisallowsHandle::currentandHandle::try_currentin the crate.DirEntrycarries the size the backend listed.lookupandgetattrtake it from the parent's listing and answer EIO when it is unknown or the listing fails, so a file is never presented as empty andcpnever copies an empty file and succeeds.Backend::read_rangewith the listedFileEntry, instead of downloading the whole file per read. Local, S3, Drive and P2P already implement it on main.BACKEND_CALL_TIMEOUT, so a stalled request fails with EIO instead of leaving the mount unanswered.ItemId, independent of listing order), andreaddir,lookup,getattr,readand opening a directory all use it. A directory is listed by the native id of the entry its parent's listing kept, never by resolving its path again. Each listing replaces its directory's cached entries, so a removed file is forgotten.FolderIndex::list_childrencompares the parent prefix byte for byte instead of withLIKE, which matched_and%as wildcards and ignored ASCII case.list_children's empty default, so an S3 mount showed every folder as empty.Backend::lists_children()now says whether a listing is real; S3 returnsfalse, and the FUSE listing fails with an error naming the backend (EIO in the shell, a warning in the daemon log). Only FUSE reads the flag: S3list_childrenis unchanged, so every other presenter behaves as before. S3 folder listing itself is S3: list folders through list_children #116.ls -la "$SMOKE/mount/" || true. It now lists$SMOKE/mount/smoke/, checkshello.txtis listed and reads it back, each undertimeout 30.No delete, move, copy or upload behaviour changes in any backend or presenter. I checked the diff against main: no write path is touched, and the only backend changes are the P2P listing query, the Drive limiter and S3's new
lists_childrenflag, which nothing outside FUSE reads. The transfer module, recursive deletes and S3 folder delete and move from #100 are not here.Evidence:
rust:1.96.0container withfuse3and alocalbackend holdinghello.txt,sub/inner.txtand a 300,000-bytebig.bin. Main's binary:lsof the backend directory fails withInput/output error, every laterls,stat,catandcphangs until killed after 20 s, and the log showsthread 'fuser-0' panicked at crates/presenter-fuse/src/ops.rs:215:18. This branch: both directories list,statreports 11, 300000 and 11 bytes, bothcats return their content,cpofbig.binmatches the original undercmp, and the log has no panic.read_dir_sync_serves_a_thread_outside_any_runtime(panics atops.rs:215:18),list_children_matches_the_parent_exactly(P2P),rate_limiter_refills_as_time_passes(Drive, never gets a token). The other new tests (sync_helpers_serve_a_thread_outside_any_runtime,read_sync_fetches_only_the_requested_range,file_of_unknown_size_is_never_presented_as_empty,a_stalled_backend_call_fails_within_the_bound,same_named_files_resolve_to_one_entry_everywhere,a_relisted_directory_forgets_removed_files,a_directory_lists_the_contents_of_the_entry_its_parent_chose,a_backend_without_a_listing_fails_instead_of_listing_empty,merge_listing_carries_each_files_size, and S3declares_that_it_cannot_list_children) use APIs main does not have; the mount run above is their failing-on-main evidence.cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo clippy -p cascade-engine --no-default-features --features portable -- -D warnings,cargo test --workspace,cargo doc --workspace --no-deps --document-private-itemswith warnings denied, andgitlintpass.Known limit, as in #100: the kernel's file size comes from the last
LOOKUPorGETATTRreply (1 s attribute TTL) whileread_rangereads current content, so a file that changes in between can read short or truncated until the attributes refresh.Fixes #99