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.
Mearman
force-pushed
the
fix/fuse-runtime-handle
branch
from
December 1, 2026 09:32
115587e to
3e70015
Compare
metadata resolved each path component from the first page of its parent's listing only, so an entry Drive returned on a later page was reported as not found while list_children listed it. The walk now uses list_files_all_pages, as the other views do. Fixes #101
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.
S3Backend had no list_children, so it inherited the trait default that returns nothing: an S3 mount listed empty and looked healthy. list_children now lists the root or a folder prefix one level deep with a / delimiter, following continuation tokens through every page, and an object key is an error rather than an empty folder. metadata resolves a path with no object of its own as a folder when keys sit under it, so presenters can open subfolders by path.
The default returned an empty listing, which is indistinguishable from an empty directory, so a backend that forgot it mounted as empty. The default is gone; the null backend and the test doubles now say explicitly that they list nothing.
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.
Resolving a path fetched every page of each parent's listing before looking for the component. The walk now stops at the first page that holds it.
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.
Cross-backend moves downloaded a directory as if it were a file, wrote it to the destination as an empty file, possibly over an existing one, and then deleted the source. The new vfs::transfer module copies a file or a whole tree, never writes a directory as a file, refuses to put a directory over a file or the reverse, reads every copied file back to check its size, and deletes a move's source only after the whole copy succeeded. delete_tree removes a directory with its contents, and keep_one_per_name is the one rule for choosing among same-named entries. VfsTree::rename uses move_across. Backend::delete now states its contract: a file or an empty directory, never recursive, with a non-empty directory refused as Conflict.
move_entry rewrote only the directory's own row, orphaning every row under it, and delete tombstoned a directory while its children stayed live. A directory now moves with all its descendants, a destination of the other kind is refused, a non-empty directory is refused on delete, and metadata reports a missing path as NotFound.
The path walk took the first entry with a matching name, which could be a file or a different folder than the one presenters list, so a folder could show another folder's contents. Each component is now looked up with a name-filtered query, paged to the end, and the entry with the smallest id is chosen, as keep_one_per_name does; a component followed by more path must be a folder. The walk records shared-drive ids again, reports a missing path as NotFound, and delete refuses a folder that still lists anything, since trashing it is recursive.
ListObjectsV2 values were used without decoding XML entities, so a key with & or < was listed under its escaped form; they are now decoded and an unknown entity is an error. Keys with a . or .. segment are left out of listings, since no path can name them. delete of a folder sent one DELETE for its marker and reported success with every key under it left behind. It is now refused while anything sits under the prefix and removes only the marker once it is empty. move_entry of a folder copied one key; it now copies every key under the prefix, checks each copy's size, and only then deletes the source keys, and it refuses a destination that already exists as a folder or as the other kind.
cascade mv and cp, the FFI rename and the WebDAV MOVE across backends now copy whole trees and delete the source only after the copy verifies. WebDAV COPY copies through the backends instead of adding an in-memory item. WebDAV DELETE and the FFI delete, which their protocols define as recursive, use delete_tree; cascade rm, NFS RMDIR and REMOVE, the web API and the File Provider keep the non-recursive delete, and the web API answers a non-empty directory with 409. WebDAV lists a backend's root by the backend's own root id, so an S3 root is no longer listed as empty.
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.
The P2P delete and move_entry changes conflict with main, which has since rewritten both to write through write_atomically. They return to their previous form here and are made against main separately, so this branch keeps only P2P metadata reporting a missing path as NotFound, which cross-backend copies rely on.
copy_tree built child paths with Path::join, which inserts a backslash on Windows, so a copied tree landed under keys such as copied\a.jpg on backends that take the path as written (S3 keys, P2P index paths). Child paths are now joined with / explicitly.
This was referenced Dec 1, 2026
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.
fuser calls every
Filesystemmethod on its own session thread, which belongs to no Tokio runtime.read_dir_sync,read_syncandmetadata_size_synccalledHandle::current()there, so the first listing panicked the session thread andlson the mount got an I/O error or hung.The daemon now passes its runtime handle to
FusePresenter, which hands it toFuseOps, and the helpers block on that handle.crates/presenter-fuse/clippy.tomldisallowsHandle::currentandHandle::try_currentin the crate, so the class fails clippy rather than a mount. Every FUSE callback that touches a backend goes through those helpers; the NFS handlers run insideblock_in_placeon runtime workers and the ProjFS provider already takes its handle explicitly, so neither has this problem.With listing fixed, reads through the mount still returned nothing:
lookupreplied with size zero for every file, and the kernel bounds reads by that size and refreshes expired entries withLOOKUPalone.lookupandgetattrnow share one helper that takes the size from the backend's metadata. That is the second commit.Evidence, from an unprivileged user in a privileged container with fuse3 and a
localbackend:ls: reading directory ...: Input/output error,findkilled after 20 s, and the log showsthread 'fuser-0' panicked at crates/presenter-fuse/src/ops.rs:215:18: there is no reactor running.lsandfindlistsmoke/hello.txtandsmoke/sub/inner.txt,statreports size 11,catreturnspre-seeded, no panic in the log.sync_helpers_serve_a_thread_outside_any_runtimecalls the helpers from a plain thread while a runtime exists elsewhere. On main it fails with the same panic atops.rs:215:18. The clippy config, applied to main's code, reports the threeHandle::currentcalls.cargo fmt --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepass.CI: Tier 3 of the Linux smoke test ran
ls -la "$SMOKE/mount/" || true, which is why it passed over this. It now lists$SMOKE/mount/smoke/, checkshello.txtis listed and reads it back, each undertimeout 30. I ran the Prepare and Tier 3 steps from thisci.ymlagainst both binaries: 0.1.144 fails at thelswith the I/O error, this branch passes. The smoke job only runs after a release, so this PR's own CI does not exercise it. #98 also edits the smoke job (the FUSE package install); this change is limited to the listing lines in Tier 3, a different hunk.Fixes #99
Update 2026-12-01: sizes, range reads, call bound, Drive paging
Review found more on the same paths; each is a new commit.
lookupandgetattrturned a failed metadata call, or a file with no size, into size 0, so the kernel read the file as empty andcpcopied an empty file and succeeded.DirEntrynow carries the listed size (Nonefor directories and for files with no byte size; on Drive that is shortcuts and folders, while Google Docs editor files do report a size, per the Drivefilesresource). Both handlers take the size from the parent's listing and answer EIO when it is unknown or the listing fails, solookupmakes no metadata call.read_rangewith theFileEntrythe listing returned. Local, S3, Drive and P2P all implement it with an empty result at or past the end; S3 and Drive treat 416 that way and slice a full 200 response.BACKEND_CALL_TIMEOUT(30 s), so one stalled request fails with EIO instead of leaving the mount unanswered.GDriveBackend::metadataresolved each path component from the first listing page only. It now pages, as the other views do (gdrive: metadata finds a path component only on the first listing page #101).New tests:
read_sync_fetches_only_the_requested_rangefails on the previous head (the read path calleddownload).file_of_unknown_size_is_never_presented_as_empty,a_stalled_backend_call_fails_within_the_boundandmerge_listing_carries_each_files_sizecover APIs that did not exist before.metadata_resolves_component_on_a_later_listing_pagefailed before the Drive fix with "Path not found". In the container mount testcpof a mounted file now produces an identical copy, and the edited smoke steps pass onubuntu:26.04.Known limit: the kernel's file size comes from the last
LOOKUPorGETATTRreply (1 s attribute TTL), whileread_rangereads the file's current content. A file that changes between the two can read short (it shrank) or truncated at the old size (it grew) until the attributes refresh. Closing it would need the content pinned per open file handle, which this change does not do.Update 2026-12-01: second review
lookupandgetattrtook the first, so a read could serve one file's bytes at the other's size. A FUSE listing now keeps one entry per name, the one with the smallestItemId, independent of listing order, and every handler uses it. Each listing replaces its directory's cached entries, so a removed file is forgotten, andreaddirreports a failed listing as EIO.list_childrenmatched withLIKE, so listinga_balso listedaxbandA_B. It now compares the prefix byte for byte. This query also exists on main, which has moved on in this file since the branch point, so a merge may need this hunk carried across.S3Backendhad nolist_childrenand inherited an empty default, so an S3 mount listed empty and succeeded. It now lists the root or a folder prefix one level deep with paging, an object key is an error, andmetadataresolves a key prefix with no object of its own as a folder. The trait default is gone: every backend implementslist_children, and the null backend and test doubles say explicitly that they list nothing.New tests, each failing before its fix:
list_children_matches_the_parent_exactly(p2p), three of the four infolder_listing.rs(S3: paging, folder by path, object key; the fourth, a missing path stays not found, guards the new folder probe and passed before too),rate_limiter_refills_as_time_passesandmetadata_stops_at_the_page_holding_the_component(Drive),same_named_files_resolve_to_one_entry_everywhereanda_relisted_directory_forgets_removed_files(FUSE).Update 2026-12-01: third review
vfs::transfer::keep_one_per_name); a component followed by more path must be a folder. This replaces the earlier "stop at the first page" walk, which cannot apply a tie-break. The walk records shared-drive ids again.Backend::deleteremoves a file or an empty directory and refuses a non-empty one withConflict, as the local backend already did. Drive (whose trash is recursive) now refuses a non-empty folder, and P2P (which orphaned children) does so in fix(backend-p2p): move a directory with its contents, delete only empty #107; S3 refuses while any key sits under the prefix and otherwise deletes the marker.vfs::transfer::delete_treeempties a directory first and is used where the protocol defines delete as recursive: WebDAVDELETE, the FFIdelete(AndroiddeleteDocument, iOS recursivedeleteItem) and the source side of a cross-backend move.cascade rm, NFSRMDIRandREMOVE, the web API (now 409 for a non-empty directory) and File Providerdelete_itemstay non-recursive.vfs::transfer::copy_treeandmove_acrosscopy files and whole trees, never write a directory as a file, refuse a directory over a file or the reverse, read every copied file back to check its size, and delete a move's source only after the whole copy succeeds. Used byVfsTree::rename(and so NFS rename),cascade mvandcp, the FFI rename and WebDAVMOVEacross backends; WebDAVCOPYnow copies through the backends instead of adding an in-memory item. S3move_entrymoves a folder key by key (copy and verify every key, then delete the sources); P2Pmove_entrymoving a directory with all its rows is fix(backend-p2p): move a directory with its contents, delete only empty #107.Backend::root_native_id(S3's is/). The other presenters already did: NFS (throughVfsTree::read_dir) and the FFI go throughresolve_listing_native_id, File Provider lists by ids taken from entries, and FUSE lists a root byroot_native_id..or..segment.New tests, each run against the previous head and failing there:
parse_list_response_decodes_entities_and_skips_dot_segments,parse_list_response_rejects_an_unknown_entity,deleting_a_non_empty_folder_is_refused_and_deletes_nothingandmoving_a_folder_moves_every_key_under_it(S3),metadata_descends_into_the_chosen_folder_among_same_named_entries(Drive),expand_root_lists_the_backends_own_root_id(WebDAV),a_directory_lists_the_contents_of_the_entry_its_parent_chose(FUSE). Thevfs::transfertests (folder move across backends, a failed copy leaves the source, no folder over file or the reverse, overwrite,delete_tree,VfsTree::renameof a folder) cover an API that did not exist before.deleting_an_empty_folder_removes_its_markerpassed before too.The P2P directory move and non-recursive delete started on this branch but conflicted with main, which has since rewritten both functions around
write_atomically, so they moved to #107 against main and this branch keeps only P2PmetadatareportingNotFound(which cross-backend copies rely on). A trial merge of this branch with main is clean and passes fmt, clippy and the whole test suite, and #107 merges with this branch without conflict.Update 2026-12-01: parked in favour of #117
This branch grew well past the mount crash, and the cross-backend copy, move and delete it adds can lose files. The read-only mount fix is now #117, rebuilt on main with no write-path changes, and this pull request stays a draft. What remains here is tracked in #110 (recursive delete of a mount root), #111 (folder move merging into existing folders, case collisions), #112 (move deleting files added during the copy), #114 (row-less and peer-created subfolders left behind), #115 (non-recursive delete breaking web API and File Provider folder deletes) and #116 (S3 folder listing).