Implement SMB Byte-range Lock (Phase 7)
- Add LockManager to oplock.rs: - LockRange struct for tracking byte-range locks - acquire() - check conflicts before granting lock - release() - remove specific lock by offset/length - clear() - clear all locks when file closed - ranges_overlap() - helper for conflict detection - Add LockManager to ServerState - Update handlers/lock.rs: - Parse LockRequest and LockElement - Process each lock element (acquire/release) - Support FLAG_EXCLUSIVE_LOCK, FLAG_SHARED_LOCK, FLAG_UNLOCK - Return STATUS_LOCK_NOT_GRANTED on conflict - Update handlers/close.rs: - Clear all locks when file closed - Add STATUS_LOCK_NOT_GRANTED to ntstatus.rs All 229 tests pass.
This commit is contained in:
Vendored
+3
@@ -198,6 +198,8 @@ pub struct ServerState {
|
||||
pub shutting_down: Arc<AtomicBool>,
|
||||
/// Global oplock state manager (Phase 2).
|
||||
pub oplock_manager: Arc<crate::oplock::OplockManager>,
|
||||
/// Global byte-range lock manager (Phase 7).
|
||||
pub lock_manager: Arc<crate::oplock::LockManager>,
|
||||
}
|
||||
|
||||
impl ServerState {
|
||||
@@ -211,6 +213,7 @@ impl ServerState {
|
||||
shutdown: Arc::new(Notify::new()),
|
||||
shutting_down: Arc::new(AtomicBool::new(false)),
|
||||
oplock_manager: Arc::new(crate::oplock::OplockManager::new()),
|
||||
lock_manager: Arc::new(crate::oplock::LockManager::new()),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user