]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/scavenger: call smbXsrv_open_cleanup() before share_mode_cleanup_disconnected()
authorRalph Boehme <slow@samba.org>
Mon, 25 Mar 2024 14:53:15 +0000 (15:53 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 6 Jun 2025 16:16:34 +0000 (16:16 +0000)
This ensures smbXsrv_open_cleanup(), which checks durable_timeout_msec, will detect
a repeated DH disconnect that has reset the durable_timeout_msec.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
selftest/knownfail.d/samba3.smb2.durable-v2-open [deleted file]
source3/smbd/scavenger.c
source3/smbd/smbXsrv_open.c

diff --git a/selftest/knownfail.d/samba3.smb2.durable-v2-open b/selftest/knownfail.d/samba3.smb2.durable-v2-open
deleted file mode 100644 (file)
index f882fbc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.durable-v2-open.reconnect-twice\(.*\)
index ec63b1517028ffad8eba245c241067c081513cc9..2e04df662ef7e444a2790b5ee58ff79a9488c5a4 100644 (file)
@@ -613,6 +613,16 @@ static void scavenger_timer(struct tevent_context *ev,
                  file_id_str_buf(ctx->msg.file_id, &idbuf),
                  timeval_string(talloc_tos(), &t, true));
 
+       status = smbXsrv_open_cleanup(ctx->msg.open_persistent_id);
+       if (!NT_STATUS_IS_OK(status)) {
+               DBG_WARNING("Failed to cleanup open global for file %s open "
+                           "%"PRIu64": %s\n",
+                           file_id_str_buf(ctx->msg.file_id, &idbuf),
+                           ctx->msg.open_persistent_id,
+                           nt_errstr(status));
+               return;
+       }
+
        ok = share_mode_cleanup_disconnected(ctx->msg.file_id,
                                             ctx->msg.open_persistent_id);
        if (!ok) {
@@ -622,14 +632,6 @@ static void scavenger_timer(struct tevent_context *ev,
                            ctx->msg.open_persistent_id);
        }
 
-       status = smbXsrv_open_cleanup(ctx->msg.open_persistent_id);
-       if (!NT_STATUS_IS_OK(status)) {
-               DBG_WARNING("Failed to cleanup open global for file %s open "
-                           "%"PRIu64": %s\n",
-                           file_id_str_buf(ctx->msg.file_id, &idbuf),
-                           ctx->msg.open_persistent_id,
-                           nt_errstr(status));
-       }
 }
 
 static void scavenger_add_timer(struct smbd_scavenger_state *state,
index 467b2f394ee31ecb7ed0483810470c9bfa5ab95a..a2364137aaf618abe692221ab9fda58726c0c493 100644 (file)
@@ -1475,7 +1475,7 @@ static void smbXsrv_open_cleanup_fn(
        }
 
        if (!delete_open) {
-               state->status = NT_STATUS_OK;
+               state->status = NT_STATUS_CANNOT_DELETE;
                return;
        }
 do_delete:
@@ -1494,6 +1494,7 @@ do_delete:
                  "deleted record from %s\n",
                  state->global_id,
                  dbwrap_name(dbwrap_record_get_db(rec)));
+       state->status = NT_STATUS_OK;
 }
 
 NTSTATUS smbXsrv_open_cleanup(uint64_t persistent_id)