diff options
author | Jeremy Allison <jra@samba.org> | 2003-04-22 01:12:54 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-04-22 01:12:54 +0000 |
commit | 6fc28bceb715039ec893861860b536b3cb201f88 (patch) | |
tree | 54dd079e64e9371c75e22e6b94e31eb25c8a08b5 /source3 | |
parent | 8d5d0947260e260433f97dad71f640b04a3187b0 (diff) | |
download | samba-6fc28bceb715039ec893861860b536b3cb201f88.tar.gz samba-6fc28bceb715039ec893861860b536b3cb201f88.tar.bz2 samba-6fc28bceb715039ec893861860b536b3cb201f88.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 f8021af2a7b790e739a7ecc67c908289b0a9b719)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/close.c | 2 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 11 |
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 d6c44893d6..632dfe9e29 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)); |