]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: tweak process_oplock_break_message() to support saved lease breaks
authorRalph Boehme <slow@samba.org>
Sun, 31 Aug 2025 11:40:27 +0000 (13:40 +0200)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:36 +0000 (10:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/smb2_oplock.c

index dc7565e706c6575138e03e215d3d9a2b3d795021..fa07a9bf6ede6f3e8bd7b59a2e7e5688fd539801 100644 (file)
@@ -953,7 +953,20 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx,
                break_from = current_state;
                break_to &= current_state;
 
-               if (breaking) {
+               if (breaking && (breaking_to_requested == current_state)) {
+                       /*
+                        * A "saved" oplock break stored by
+                        * delay_for_oplock_fn() when breaking the lease of a
+                        * disconnected Persistent Handle and dispatched by
+                        * SMB_VFS_RECONNECT().
+                        */
+                       SMB_ASSERT(fsp->op->global->persistent);
+                       breaking = true;
+                       breaking_to_required = break_to;
+                       breaking_to_requested = break_to;
+                       /* Need to increment the epoch */
+                       epoch += 1;
+               } else if (breaking) {
                        break_to &= breaking_to_required;
                        if (breaking_to_required != break_to) {
                                /*