]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: avoid remove_oplock() in close_remove_share_mode()
authorStefan Metzmacher <metze@samba.org>
Mon, 12 Sep 2022 23:30:48 +0000 (01:30 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 20 Sep 2022 00:34:36 +0000 (00:34 +0000)
This inlines remove_oplock() into close_remove_share_mode() and
calls remove_share_oplock() and release_file_oplock() directly.

The idea is that we'll soon call remove_share_oplock()
under a tdb chainlock, while release_file_oplock() needs to be called outside.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/close.c

index dfb1fa56cbda518cc70416f4c27a73dc90966c8d..fbbfdccf37278e6eaf0e0b79ba2e07d9950f83ad 100644 (file)
@@ -315,8 +315,19 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
        }
 
        /* Remove the oplock before potentially deleting the file. */
-       if(fsp->oplock_type) {
-               remove_oplock(fsp);
+       if (fsp->oplock_type != NO_OPLOCK) {
+               bool ok;
+
+               ok = remove_share_oplock(lck, fsp);
+               if (!ok) {
+                       struct file_id_buf buf;
+
+                       DBG_ERR("failed to remove share oplock for "
+                               "file %s, %s, %s\n",
+                               fsp_str_dbg(fsp), fsp_fnum_dbg(fsp),
+                               file_id_str_buf(fsp->file_id, &buf));
+               }
+               release_file_oplock(fsp);
        }
 
        if (fsp->fsp_flags.write_time_forced) {