From: Volker Lendecke Date: Tue, 3 Nov 2020 16:36:08 +0000 (+0100) Subject: locking: Make share_mode_watch_send() take "share_mode_lock" X-Git-Tag: samba-4.14.0rc1~668 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84dba041a35d75657a2738157fdddc83aeb7a2a0;p=thirdparty%2Fsamba.git locking: Make share_mode_watch_send() take "share_mode_lock" This makes clear that this can only be done under a lock Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/share_mode_lock.c b/source3/locking/share_mode_lock.c index f4f563ee37c..6ac6016e5e0 100644 --- a/source3/locking/share_mode_lock.c +++ b/source3/locking/share_mode_lock.c @@ -1131,10 +1131,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 file_id id, + struct share_mode_lock *lck, struct server_id blocker) { - TDB_DATA key = locking_key(&id); + TDB_DATA key = locking_key(&lck->data->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 f2f35d99487..b2076254ace 100644 --- a/source3/locking/share_mode_lock.h +++ b/source3/locking/share_mode_lock.h @@ -101,7 +101,7 @@ bool share_mode_have_entries(struct share_mode_lock *lck); struct tevent_req *share_mode_watch_send( TALLOC_CTX *mem_ctx, struct tevent_context *ev, - struct file_id id, + struct share_mode_lock *lck, 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 30bb84c0a7b..ef2fe321f5c 100644 --- a/source3/smbd/blocking.c +++ b/source3/smbd/blocking.c @@ -578,7 +578,7 @@ static void smbd_smb1_do_locks_try(struct tevent_req *req) setup_retry: subreq = share_mode_watch_send( - state, state->ev, lck->data->id, blocking_pid); + state, state->ev, lck, blocking_pid); if (tevent_req_nomem(subreq, req)) { goto done; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index b7f050b80de..1419fb5128d 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2772,7 +2772,7 @@ static void defer_open(struct share_mode_lock *lck, watch_req = share_mode_watch_send( watch_state, req->sconn->ev_ctx, - lck->data->id, + lck, (struct server_id){0}); if (watch_req == NULL) { exit_server("Could not watch share mode record"); @@ -2893,7 +2893,7 @@ static bool setup_poll_open( open_rec->watch_req = share_mode_watch_send( open_rec, req->sconn->ev_ctx, - lck->data->id, + lck, (struct server_id) {0}); if (open_rec->watch_req == NULL) { DBG_WARNING("share_mode_watch_send failed\n"); diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c index 12ad12aaf93..b07c9ff93c0 100644 --- a/source3/smbd/smb2_lock.c +++ b/source3/smbd/smb2_lock.c @@ -669,7 +669,7 @@ setup_retry: DBG_DEBUG("Watching share mode lock\n"); subreq = share_mode_watch_send( - state, state->ev, lck->data->id, blocking_pid); + state, state->ev, lck, blocking_pid); TALLOC_FREE(lck); if (tevent_req_nomem(subreq, req)) { return; diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c index bd2caab862a..c8071a73498 100644 --- a/source3/smbd/smb2_setinfo.c +++ b/source3/smbd/smb2_setinfo.c @@ -269,7 +269,7 @@ static struct tevent_req *delay_rename_for_lease_break(struct tevent_req *req, subreq = share_mode_watch_send( rename_state, ev, - lck->data->id, + lck, (struct server_id){0}); if (subreq == NULL) {