summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/smbd/close.c2
-rw-r--r--source3/smbd/oplock.c11
2 files changed, 6 insertions, 7 deletions
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 9cb191c4e2..5cca85500f 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -201,7 +201,7 @@ with error %s\n", fsp->fsp_name, strerror(errno) ));
unlock_share_entry_fsp(fsp);
- if(EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
+ if(fsp->oplock_type)
release_file_oplock(fsp);
locking_close_file(fsp);
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index f5c19bcf62..8525687793 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -226,12 +226,12 @@ tv_sec = %x, tv_usec = %x\n",
void release_file_oplock(files_struct *fsp)
{
- if (koplocks)
+ if ((fsp->oplock_type != NO_OPLOCK) && koplocks)
koplocks->release_oplock(fsp);
if (fsp->oplock_type == LEVEL_II_OPLOCK)
level_II_oplocks_open--;
- else
+ else if (fsp->oplock_type)
exclusive_oplocks_open--;
fsp->oplock_type = NO_OPLOCK;
@@ -270,7 +270,7 @@ BOOL remove_oplock(files_struct *fsp, BOOL break_to_none)
if (lock_share_entry_fsp(fsp) == False) {
DEBUG(0,("remove_oplock: failed to lock share entry for file %s\n",
fsp->fsp_name ));
- ret = False;
+ return False;
}
if (fsp->sent_oplock_break == EXCLUSIVE_BREAK_SENT || break_to_none) {
@@ -626,12 +626,11 @@ BOOL oplock_break_level2(files_struct *fsp, BOOL local_request, int token)
DEBUG(0,("oplock_break_level2: unable to remove level II oplock for file %s\n", fsp->fsp_name ));
}
+ release_file_oplock(fsp);
+
if (!local_request && got_lock)
unlock_share_entry_fsp(fsp);
- fsp->oplock_type = NO_OPLOCK;
- level_II_oplocks_open--;
-
if(level_II_oplocks_open < 0) {
DEBUG(0,("oplock_break_level2: level_II_oplocks_open < 0 (%d). PANIC ERROR\n",
level_II_oplocks_open));