From 32d68b8ec3aee7853c7547296e829277515813d1 Mon Sep 17 00:00:00 2001 From: Tim Prouty Date: Tue, 3 Feb 2009 23:17:48 -0800 Subject: s3 oplocks: Remove oplocks before handling delete on close semantics Unlinking a file while still holding an oplock can cause problems with kernel oplocks. This simply releases the oplock before actually unlinking the file. --- source3/smbd/close.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/smbd/close.c') diff --git a/source3/smbd/close.c b/source3/smbd/close.c index e484fa8e01..78b8123680 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -553,6 +553,11 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp, return NT_STATUS_OK; } + /* Remove the oplock before potentially deleting the file. */ + if(fsp->oplock_type) { + release_file_oplock(fsp); + } + /* If this is an old DOS or FCB open and we have multiple opens on the same handle we only have one share mode. Ensure we only remove the share mode on the last close. */ @@ -562,10 +567,6 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp, saved_status3 = close_remove_share_mode(fsp, close_type); } - if(fsp->oplock_type) { - release_file_oplock(fsp); - } - locking_close_file(smbd_messaging_context(), fsp); status = fd_close(fsp); -- cgit