From: Ralph Boehme Date: Wed, 8 Jan 2025 14:43:04 +0000 (+0100) Subject: s3/brlock: don't increment current_lock_count if do_lock_fn() failed X-Git-Tag: samba-4.22.1~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5170196a6d8664f695117f67befbf57f735d78d7;p=thirdparty%2Fsamba.git s3/brlock: don't increment current_lock_count if do_lock_fn() failed 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 Reviewed-by: Stefan Metzmacher (cherry picked from commit 3a0c6e99de4377f44bc29766b6ceb79040caed9f) --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index dd963e4fbaa..e81b3ca95be 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -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; } /****************************************************************************