]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/locking: simplify reset_share_mode_entry()
authorRalph Boehme <slow@samba.org>
Mon, 27 Oct 2025 14:53:46 +0000 (15:53 +0100)
committerVolker Lendecke <vl@samba.org>
Mon, 8 Dec 2025 10:20:36 +0000 (10:20 +0000)
Since 3df388b8f148c00a3ef331d393cea976fb9340b3 we're using the open global_id as
share_file_id in the share_mode_entry and we're also not changing it in
mark_share_mode_disconnected().

Iow, old_share_file_id is equal to new_share_file_id which and both are equal to
open_global_id.

Hence replace the two old_share_file_id and new_share_file_id arguments with the
single open_global_id argument.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/locking/share_mode_lock.c
source3/locking/share_mode_lock.h
source3/smbd/durable.c

index 66a7c1b6c0487719fc2316314adfd1353f323688..66af151c7f5dc4b7c07ab9a3f2b0856b18d620d5 100644 (file)
@@ -2741,8 +2741,7 @@ bool mark_share_mode_disconnected(struct share_mode_lock *lck,
                messaging_server_id(fsp->conn->sconn->msg_ctx),
                fsp->op->global->open_persistent_id,
                disconnected_pid,
-               UINT64_MAX,
-               fsp->op->global->open_persistent_id);
+               UINT64_MAX);
 
        return ok;
 }
@@ -2750,10 +2749,9 @@ bool mark_share_mode_disconnected(struct share_mode_lock *lck,
 bool reset_share_mode_entry(
        struct share_mode_lock *lck,
        struct server_id old_pid,
-       uint64_t old_share_file_id,
+       uint64_t open_global_id,
        struct server_id new_pid,
-       uint64_t new_mid,
-       uint64_t new_share_file_id)
+       uint64_t new_mid)
 {
        struct file_id id = share_mode_lock_file_id(lck);
        struct share_mode_data *d = NULL;
@@ -2801,7 +2799,7 @@ bool reset_share_mode_entry(
                ltdb->share_entries,
                ltdb->num_share_entries,
                new_pid,
-               new_share_file_id,
+               open_global_id,
                &e,
                &found);
        if (found) {
@@ -2810,7 +2808,7 @@ bool reset_share_mode_entry(
                        file_id_str_buf(id, &id_buf),
                        ltdb->num_share_entries,
                        server_id_str_buf(new_pid, &pid_buf2),
-                       new_share_file_id);
+                       open_global_id);
                goto done;
        }
 
@@ -2818,7 +2816,7 @@ bool reset_share_mode_entry(
                ltdb->share_entries,
                ltdb->num_share_entries,
                old_pid,
-               old_share_file_id,
+               open_global_id,
                &e,
                &found);
        if (!found) {
@@ -2827,7 +2825,7 @@ bool reset_share_mode_entry(
                            file_id_str_buf(id, &id_buf),
                            ltdb->num_share_entries,
                            server_id_str_buf(old_pid, &pid_buf1),
-                           old_share_file_id);
+                           open_global_id);
                goto done;
        }
        DBG_DEBUG("%s - num_share_modes=%zu "
@@ -2836,17 +2834,17 @@ bool reset_share_mode_entry(
                  file_id_str_buf(id, &id_buf),
                  ltdb->num_share_entries,
                  server_id_str_buf(old_pid, &pid_buf1),
-                 old_share_file_id,
+                 open_global_id,
                  old_idx,
                  server_id_str_buf(new_pid, &pid_buf2),
-                 new_share_file_id,
+                 open_global_id,
                  new_idx);
 
        e.pid = new_pid;
        if (new_mid != UINT64_MAX) {
                e.op_mid = new_mid;
        }
-       e.share_file_id = new_share_file_id;
+       e.share_file_id = open_global_id;
 
        ok = share_mode_entry_put(&e, &e_buf);
        if (!ok) {
index 82668cd977a6afab501971e41cab49971cade0ad..b4f2848d81b66d945caba08db7db77d20ef21a5e 100644 (file)
@@ -61,10 +61,9 @@ bool set_share_mode(
 bool reset_share_mode_entry(
        struct share_mode_lock *lck,
        struct server_id old_pid,
-       uint64_t old_share_file_id,
+       uint64_t open_global_id,
        struct server_id new_pid,
-       uint64_t new_mid,
-       uint64_t new_share_file_id);
+       uint64_t new_mid);
 
 bool mark_share_mode_disconnected(
        struct share_mode_lock *lck, struct files_struct *fsp);
index fe6dd00b64a9e22b0c85aae82f63bf2633fddc3e..41f4aaae1de5b63a1cedebacc6df603b12516f30 100644 (file)
@@ -670,8 +670,7 @@ static void vfs_default_durable_reconnect_fn(struct share_mode_lock *lck,
                e.pid,
                e.share_file_id,
                messaging_server_id(fsp->conn->sconn->msg_ctx),
-               state->smb1req->mid,
-               fh_get_gen_id(fsp->fh));
+               state->smb1req->mid);
        if (!ok) {
                DBG_DEBUG("Could not set new share_mode_entry values\n");
                state->status = NT_STATUS_INTERNAL_ERROR;