From: Ralph Boehme Date: Sun, 13 Oct 2024 09:57:45 +0000 (+0200) Subject: s3/locking: pass file_id instead of lck to share_mode_watch_send() X-Git-Tag: tdb-1.4.13~725 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6703538126f6b8ab732714eb1e24b8db03d4594f;p=thirdparty%2Fsamba.git s3/locking: pass file_id instead of lck to share_mode_watch_send() 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 Reviewed-by: Stefan Metzmacher --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index 1f2c931c12b..8ccb3bdeaec 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -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; diff --git a/source3/locking/share_mode_lock.h b/source3/locking/share_mode_lock.h index 33ed8e034e6..97a7a847f54 100644 --- a/source3/locking/share_mode_lock.h +++ b/source3/locking/share_mode_lock.h @@ -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); diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c index 8b41288bfbf..806d24927ab 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -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; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 351b8f8e33e..17618749a92 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index 58610a52faa..b90fbb1dfcb 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -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; diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index 3ddf24d7fdd..17bc68362f9 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -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;