Implement SMB Oplocks Phase 4+6
Phase 4: CREATE Handler dynamic oplock granting - Use OplockManager.can_grant() to determine oplock level - Register OplockEntry if oplock granted - Support ShareAccess compatibility checking - Grant Level II if exclusive/batch oplock exists Phase 6: CLOSE Handler oplock cleanup - Unregister from OplockManager when file closed - Only unregister if oplock_level > 0 All 229 tests pass.
This commit is contained in:
8
vendor/smb-server/src/handlers/close.rs
vendored
8
vendor/smb-server/src/handlers/close.rs
vendored
@@ -15,7 +15,7 @@ use crate::server::ServerState;
|
||||
const FLAG_POSTQUERY_ATTRIB: u16 = 0x0001;
|
||||
|
||||
pub async fn handle(
|
||||
_server: &Arc<ServerState>,
|
||||
server: &Arc<ServerState>,
|
||||
conn: &Arc<Connection>,
|
||||
hdr: &Smb2Header,
|
||||
body: &[u8],
|
||||
@@ -43,9 +43,15 @@ pub async fn handle(
|
||||
let handle = open.handle.take();
|
||||
let path = open.last_path.clone();
|
||||
let delete_on_close = open.delete_on_close;
|
||||
let oplock_level = open.oplock_level;
|
||||
let want_attrs = req.flags & FLAG_POSTQUERY_ATTRIB != 0;
|
||||
drop(open);
|
||||
|
||||
// Phase 6: Unregister from OplockManager if oplock was granted
|
||||
if oplock_level > 0 {
|
||||
server.oplock_manager.unregister(&path, &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