Skip to content

fix(ragfs): return config error instead of panicking when pathlock manager is missing - #4106

Open
korjavin wants to merge 1 commit into
volcengine:mainfrom
korjavin:fix/issue-4082-mountable-pathlock-panic
Open

fix(ragfs): return config error instead of panicking when pathlock manager is missing#4106
korjavin wants to merge 1 commit into
volcengine:mainfrom
korjavin:fix/issue-4082-mountable-pathlock-panic

Conversation

@korjavin

Copy link
Copy Markdown

Summary

MountableFS::mount(), build_multi_write_fs(), and copy_within_mount() in crates/ragfs/src/core/mountable.rs called .expect() on the optional pathlock_manager. The public constructors (MountableFS::new(), with_cache) never initialize that manager, so any of the following reached on a normally-constructed instance panicked instead of returning an error:

  • an encrypted single-backend mount()
  • a multi-write mount (build_multi_write_fs)
  • the raw-copy fast path in copy_within_mount()

Fix

Replace each .expect("pathlock manager must be initialized ...") with Error::config(...) via ok_or_else, propagated with ?. All three call sites already return Result, so no signature changes were needed.

Tests

Added three regression tests exercising each previously-panicking path on a MountableFS with no pathlock manager set, asserting a Error::Config(_) is returned instead of a panic:

  • mount_encrypted_single_backend_without_pathlock_manager_returns_config_error
  • build_multi_write_fs_without_pathlock_manager_returns_config_error
  • copy_within_mount_without_pathlock_manager_returns_config_error

Ran cargo test -p ragfs --lib — 445 passed, 0 failed, 9 ignored (pre-existing, unrelated).

Fixes #4082

…nager is missing

MountableFS::mount(), build_multi_write_fs(), and copy_within_mount()
called .expect() on the optional pathlock_manager, so any encrypted
single-backend mount, multi-write mount, or raw-copy fast path reached
on a MountableFS built via the public constructors (which never
initialize that manager) panicked instead of returning an error.

Replace each .expect() with Error::config(...) via ok_or_else so
callers get a normal Result::Err. Adds regression tests covering all
three previously-panicking paths.

Fixes volcengine#4082
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

[Bug]: MountableFS panics when pathlock manager is missing on multi-write/raw-copy fast paths

1 participant