Skip to content

Conversation

@zine0
Copy link
Contributor

@zine0 zine0 commented Dec 17, 2025

No description provided.

Signed-off-by: zine yu <zine.xlws@gmail.com>
Signed-off-by: zine yu <zine.xlws@gmail.com>
Signed-off-by: zine yu <zine.xlws@gmail.com>
Signed-off-by: zine yu <zine.xlws@gmail.com>
Signed-off-by: zine yu <zine.xlws@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements POSIX file lock (plock) functionality for SlayerFS, adding support for byte-range locking across three metadata storage backends (Redis, etcd, and Database/SQLite/PostgreSQL).

Key Changes

  • Adds new file_lock module with FileLockType, PlockRecord, FileLockRange, and related types
  • Implements plock operations (get_plock, set_plock) in all three metadata stores
  • Integrates file locking into VFS layer and FUSE adapter via getlk and setlk operations
  • Adds comprehensive test coverage for lock scenarios (read/write locks, conflicts, releases, cross-session visibility)

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
project/slayerfs/src/meta/file_lock.rs Core file lock types and logic including conflict detection and lock merging
project/slayerfs/src/meta/stores/redis_store.rs Redis-backed plock implementation with session-based lock storage
project/slayerfs/src/meta/stores/etcd_store.rs etcd-backed plock implementation with atomic update support
project/slayerfs/src/meta/stores/database_store.rs Database (SQLite/PostgreSQL) plock implementation with transactional guarantees
project/slayerfs/src/fuse/mod.rs FUSE integration for getlk and setlk operations
project/slayerfs/src/vfs/fs.rs VFS layer plock methods wrapping MetaLayer calls
project/slayerfs/src/meta/entities/plock_meta.rs Database entity definition for plock table
project/slayerfs/tests/scripts/test_meta_store.sh Test automation script for metadata store testing
project/slayerfs/doc/file_lock_testing_guide.md Comprehensive testing guide and documentation
buckal.snap Build snapshot with dependency updates (contains merge conflict)
project/slayerfs/Cargo.toml Dependency updates for rfuse3 with file-lock feature
project/slayerfs/BUCK Build configuration updates for local rfuse3 dependency

Signed-off-by: zine yu <zine.xlws@gmail.com>
Ivanbeethoven
Ivanbeethoven previously approved these changes Dec 17, 2025
Copy link
Collaborator

@Ivanbeethoven Ivanbeethoven left a comment

Choose a reason for hiding this comment

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

LGTM, fix lock release later

@genedna
Copy link
Member

genedna commented Dec 18, 2025

@codex review

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.

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 1121 to 1125
Err(e) => Err(match e {
MetaError::NotFound(_) => libc::ENOENT,
MetaError::AlreadyExists { .. } => libc::EAGAIN, // Lock conflict
MetaError::NotSupported(_) => libc::ENOSYS,
_ => libc::EIO,

Choose a reason for hiding this comment

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

P1 Badge Map lock conflicts to EAGAIN in setlk

When FUSE setlk receives a lock conflict, the metadata backends return MetaError::LockConflict, but the match in setlk only translates MetaError::AlreadyExists to EAGAIN; all other errors fall through to EIO. This means any real lock contention will surface to the kernel as an I/O error instead of a retryable EAGAIN, breaking POSIX lock semantics whenever a lock is already held. Handle MetaError::LockConflict the same way as AlreadyExists so callers see a busy lock rather than an I/O failure.

Useful? React with 👍 / 👎.

Comment on lines 1841 to 1845
// Query specific owner and session
let row = PlockMeta::find()
.filter(plock_meta::Column::Inode.eq(inode))
.filter(plock_meta::Column::Owner.eq(query.owner))
.filter(plock_meta::Column::Sid.eq(*sid))

Choose a reason for hiding this comment

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

P2 Badge Database getlk ignores locks held by other sessions

The database implementation of get_plock filters the lookup by both owner and the current session id, so it only inspects locks owned by the querying process in the same session. If another owner/session holds an overlapping lock, this code returns an unlocked state rather than the conflicting lock, unlike the etcd/redis backends. As a result F_GETLK on the DB backend reports the region as free even though it is locked by someone else. Drop the owner/sid filters or merge all records so conflicts from other sessions are visible.

Useful? React with 👍 / 👎.

@genedna
Copy link
Member

genedna commented Dec 18, 2025

@codex Why the GitHub Action hang for waiting?

@chatgpt-codex-connector
Copy link

Codex couldn't complete this request. Try again later.

@genedna
Copy link
Member

genedna commented Dec 18, 2025

@claude Review the PR

Signed-off-by: zine yu <zine.xlws@gmail.com>
Copy link
Collaborator

@Ivanbeethoven Ivanbeethoven left a comment

Choose a reason for hiding this comment

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

LGTM

@Ivanbeethoven Ivanbeethoven added this pull request to the merge queue Dec 18, 2025
Merged via the queue into rk8s-dev:main with commit 281f50e Dec 18, 2025
5 checks passed
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.

3 participants