feat(fs): expose isLocked in stat() to surface path-lock state#1940
Merged
qin-ctx merged 1 commit intovolcengine:mainfrom May 9, 2026
Merged
feat(fs): expose isLocked in stat() to surface path-lock state#1940qin-ctx merged 1 commit intovolcengine:mainfrom
qin-ctx merged 1 commit intovolcengine:mainfrom
Conversation
Adds an `isLocked` boolean to the dict returned by `VikingFS.stat()` so callers (and the `/api/v1/fs/stat` endpoint, which transparently passes the dict through) can tell whether a resource is currently held by a path lock without having to attempt a write and observe `ResourceBusyError`. The lookup reuses the same conflict-detection semantics as the acquire flow: a path is reported as locked when it has a valid `.path.ovlock` or when any ancestor directory holds a SUBTREE lock; stale locks are ignored because the next acquirer would reclaim them anyway. To make the check available to higher layers, a public `PathLock.is_locked()` helper is introduced and surfaced through `LockManager.is_path_locked()`; both are best-effort and degrade to `False` when the LockManager is unavailable, keeping `stat()` resilient.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
qin-ctx
approved these changes
May 9, 2026
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.
Adds an
isLockedboolean to the dict returned byVikingFS.stat()so callers (and the/api/v1/fs/statendpoint, which transparently passes the dict through) can tell whether a resource is currently held by a path lock without having to attempt a write and observeResourceBusyError.The lookup reuses the same conflict-detection semantics as the acquire flow: a path is reported as locked when it has a valid
.path.ovlockor when any ancestor directory holds a SUBTREE lock; stale locks are ignored because the next acquirer would reclaim them anyway.To make the check available to higher layers, a public
PathLock.is_locked()helper is introduced and surfaced throughLockManager.is_path_locked(); both are best-effort and degrade toFalsewhen the LockManager is unavailable, keepingstat()resilient.Description
Related Issue
Type of Change
Changes Made
Testing
Checklist
Screenshots (if applicable)
Additional Notes