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:
3
vendor/smb-server/src/handlers/close.rs
vendored
3
vendor/smb-server/src/handlers/close.rs
vendored
@@ -52,6 +52,9 @@ pub async fn handle(
|
||||
server.oplock_manager.unregister(&path, &req.file_id).await;
|
||||
}
|
||||
|
||||
// Phase 7: Clear all byte-range locks for this file
|
||||
server.lock_manager.clear(&req.file_id).await;
|
||||
|
||||
// Stat before closing if needed.
|
||||
let info_before_close = if want_attrs {
|
||||
if let Some(h) = handle.as_ref() {
|
||||
|
||||
Reference in New Issue
Block a user