]> 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)
committerRalph Boehme <slow@samba.org>
Wed, 2 Apr 2025 18:05:48 +0000 (18:05 +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>
source3/locking/locking.c

index 62f3e2e80379812d2455df70d6d812b965f8b79f..1c5ebbcbcec32d94a3a8c4fb16147c7d08793b59 100644 (file)
@@ -344,19 +344,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;
 }
 
 /****************************************************************************