summaryrefslogtreecommitdiff
path: root/source3/smbd/close.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-02-03 23:17:48 -0800
committerTim Prouty <tprouty@samba.org>2009-02-09 23:47:45 -0800
commit32d68b8ec3aee7853c7547296e829277515813d1 (patch)
tree06b9b7efe1b829fd7425b47c2498f7bcbab890da /source3/smbd/close.c
parent17eba16bad9b20518a5d336bc751e749a587ec68 (diff)
downloadsamba-32d68b8ec3aee7853c7547296e829277515813d1.tar.gz
samba-32d68b8ec3aee7853c7547296e829277515813d1.tar.bz2
samba-32d68b8ec3aee7853c7547296e829277515813d1.zip
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.
Diffstat (limited to 'source3/smbd/close.c')
-rw-r--r--source3/smbd/close.c9
1 files changed, 5 insertions, 4 deletions
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);