]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/locking: pass file_id instead of lck to share_mode_watch_send()
authorRalph Boehme <slow@samba.org>
Sun, 13 Oct 2024 09:57:45 +0000 (11:57 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Nov 2024 14:39:30 +0000 (14:39 +0000)
In the future not all callers will have a share_mode_lock around.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/locking/share_mode_lock.c
source3/locking/share_mode_lock.h
source3/smbd/blocking.c
source3/smbd/open.c
source3/smbd/smb2_lock.c
source3/smbd/smb2_oplock.c

index 1f2c931c12bac7a455e1e31fad29da959cc48f07..8ccb3bdeaecf319549463632a986595ae731418a 100644 (file)
@@ -1425,11 +1425,10 @@ static void share_mode_watch_done(struct tevent_req *subreq);
 struct tevent_req *share_mode_watch_send(
        TALLOC_CTX *mem_ctx,
        struct tevent_context *ev,
-       struct share_mode_lock *lck,
+       struct file_id *id,
        struct server_id blocker)
 {
-       struct file_id id = share_mode_lock_file_id(lck);
-       TDB_DATA key = locking_key(&id);
+       TDB_DATA key = locking_key(id);
        struct tevent_req *req = NULL, *subreq = NULL;
        struct share_mode_watch_state *state = NULL;
 
index 33ed8e034e6af83cef389fb03b9a19c76df6c28d..97a7a847f541e290c538f32fee4d01342a25adc3 100644 (file)
@@ -134,7 +134,7 @@ void share_mode_flags_set(
 struct tevent_req *share_mode_watch_send(
        TALLOC_CTX *mem_ctx,
        struct tevent_context *ev,
-       struct share_mode_lock *lck,
+       struct file_id *id,
        struct server_id blocker);
 NTSTATUS share_mode_watch_recv(
        struct tevent_req *req, bool *blockerdead, struct server_id *blocker);
index 8b41288bfbf260f9d2276337fc9e1d5c765829f0..806d24927abdb584fc63935247a562f215ec0c68 100644 (file)
@@ -568,7 +568,7 @@ static void smbd_smb1_do_locks_try(struct tevent_req *req)
 
 setup_retry:
        subreq = share_mode_watch_send(
-               state, state->ev, lck, blocking_pid);
+               state, state->ev, &state->fsp->file_id, blocking_pid);
        if (tevent_req_nomem(subreq, req)) {
                goto done;
        }
index 351b8f8e33e2eb79cacd076291a6c342c33be31a..17618749a92785a95dd71c499aaf11025beb576a 100644 (file)
@@ -3020,7 +3020,7 @@ static void defer_open(struct share_mode_lock *lck,
        watch_req = share_mode_watch_send(
                watch_state,
                req->sconn->ev_ctx,
-               lck,
+               &id,
                (struct server_id){0});
        if (watch_req == NULL) {
                exit_server("Could not watch share mode record");
@@ -3096,6 +3096,7 @@ struct poll_open_setup_watcher_state {
        TALLOC_CTX *mem_ctx;
        struct tevent_context *ev_ctx;
        struct tevent_req *watch_req;
+       struct file_id id;
 };
 
 static void poll_open_setup_watcher_fn(struct share_mode_lock *lck,
@@ -3111,7 +3112,7 @@ static void poll_open_setup_watcher_fn(struct share_mode_lock *lck,
        state->watch_req = share_mode_watch_send(
                        state->mem_ctx,
                        state->ev_ctx,
-                       lck,
+                       &state->id,
                        (struct server_id) {0});
        if (state->watch_req == NULL) {
                DBG_WARNING("share_mode_watch_send failed\n");
@@ -3171,6 +3172,7 @@ static bool setup_poll_open(
                struct poll_open_setup_watcher_state wstate = {
                        .mem_ctx = open_rec,
                        .ev_ctx = req->sconn->ev_ctx,
+                       .id = *id,
                };
                NTSTATUS status;
 
index 58610a52faa0f126d8575e527a002c17d51ebb88..b90fbb1dfcbf0495aeb754c9640eb6749952db48 100644 (file)
@@ -688,7 +688,7 @@ setup_retry:
        DBG_DEBUG("Watching share mode lock\n");
 
        subreq = share_mode_watch_send(
-               state, state->ev, lck, blocking_pid);
+               state, state->ev, &state->fsp->file_id, blocking_pid);
        TALLOC_FREE(lck);
        if (tevent_req_nomem(subreq, req)) {
                return;
index 3ddf24d7fdd1b8121495780dbc37463c2de68d6c..17bc68362f94221a1ef07fc647512400c03d538a 100644 (file)
@@ -1500,7 +1500,7 @@ static void delay_for_handle_lease_break_fsp_check(struct tevent_req *req)
 
                subreq = share_mode_watch_send(state,
                                               state->ev,
-                                              state->lck,
+                                              &state->fsp->file_id,
                                               (struct server_id){0});
                if (tevent_req_nomem(subreq, req)) {
                        return;