summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-04-22 01:12:52 +0000
committerJeremy Allison <jra@samba.org>2003-04-22 01:12:52 +0000
commit505b3f58142f7b0148efb04b990d79bd7db09ec7 (patch)
treefee2d1441bd14d43b3340efec325114d9b8abd00 /source3
parent530dc717321abdc8f9f2f5400009119e5fad613c (diff)
downloadsamba-505b3f58142f7b0148efb04b990d79bd7db09ec7.tar.gz
samba-505b3f58142f7b0148efb04b990d79bd7db09ec7.tar.bz2
samba-505b3f58142f7b0148efb04b990d79bd7db09ec7.zip
Tidyups of some dubious logic discovered whilst trying to track down a
strange oplock related issue on the PSA. Jeremy. (This used to be commit 1dd274bf61aaaad3c475de93f53aac176678bc7c)
Diffstat (limited to 'source3')
-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));