From: Ralph Boehme Date: Mon, 25 Mar 2024 14:53:15 +0000 (+0100) Subject: s3/scavenger: call smbXsrv_open_cleanup() before share_mode_cleanup_disconnected() X-Git-Tag: tevent-0.17.0~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ff9bb28eeb8534ddae138030e1df3f3059f9063f;p=thirdparty%2Fsamba.git s3/scavenger: call smbXsrv_open_cleanup() before share_mode_cleanup_disconnected() 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 Signed-off-by: Ralph Boehme Signed-off-by: Stefan Metzmacher --- diff --git a/selftest/knownfail.d/samba3.smb2.durable-v2-open b/selftest/knownfail.d/samba3.smb2.durable-v2-open deleted file mode 100644 index f882fbcf8ee..00000000000 --- a/selftest/knownfail.d/samba3.smb2.durable-v2-open +++ /dev/null @@ -1 +0,0 @@ -^samba3.smb2.durable-v2-open.reconnect-twice\(.*\) diff --git a/source3/smbd/scavenger.c b/source3/smbd/scavenger.c index ec63b151702..2e04df662ef 100644 --- a/source3/smbd/scavenger.c +++ b/source3/smbd/scavenger.c @@ -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, diff --git a/source3/smbd/smbXsrv_open.c b/source3/smbd/smbXsrv_open.c index 467b2f394ee..a2364137aaf 100644 --- a/source3/smbd/smbXsrv_open.c +++ b/source3/smbd/smbXsrv_open.c @@ -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)