]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/brlock: don't increment current_lock_count if do_lock_fn() failed
authorRalph Boehme <slow@samba.org>
Wed, 8 Jan 2025 14:43:04 +0000 (15:43 +0100)
committerJule Anger <janger@samba.org>
Thu, 17 Apr 2025 11:31:14 +0000 (11:31 +0000)
Also only assign psmblctx and pblocker_pid if the lock request failed.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 3a0c6e99de4377f44bc29766b6ceb79040caed9f)

source3/locking/locking.c

index dd963e4fbaadd00d30fbda6175c1a615b1047720..e81b3ca95be843556c5d28fd9babc45ddb6101c3 100644 (file)
@@ -345,19 +345,21 @@ NTSTATUS do_lock(files_struct *fsp,
                          nt_errstr(status));
                return status;
        }
-
-       if (psmblctx != NULL) {
-               *psmblctx = state.blocker_smblctx;
-       }
-       if (pblocker_pid != NULL) {
-               *pblocker_pid = state.blocker_pid;
+       if (!NT_STATUS_IS_OK(state.status)) {
+               DBG_DEBUG("do_lock_fn returned %s\n",
+                         nt_errstr(state.status));
+               if (psmblctx != NULL) {
+                       *psmblctx = state.blocker_smblctx;
+               }
+               if (pblocker_pid != NULL) {
+                       *pblocker_pid = state.blocker_pid;
+               }
+               return state.status;
        }
 
-       DBG_DEBUG("returning status=%s\n", nt_errstr(state.status));
-
        increment_current_lock_count(fsp, lock_flav);
 
-       return state.status;
+       return NT_STATUS_OK;
 }
 
 /****************************************************************************