From: Volker Lendecke Date: Wed, 11 Sep 2019 14:50:24 +0000 (+0200) Subject: smbd: Pass pid/share_file_id to find_share_mode_entry() X-Git-Tag: talloc-2.3.1~796 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2185db6c610433e0651543b7179cf1fbd0e2c9eb;p=thirdparty%2Fsamba.git smbd: Pass pid/share_file_id to find_share_mode_entry() Avoid the full fsp, this makes the indexing of the share mode array clearer, and it makes the next commit easier Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 6afbb40adad..eccb680189a 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -871,10 +871,11 @@ bool set_share_mode(struct share_mode_lock *lck, } static struct share_mode_entry *find_share_mode_entry( - struct share_mode_lock *lck, files_struct *fsp) + struct share_mode_lock *lck, + struct server_id pid, + uint64_t share_file_id) { struct share_mode_data *d = lck->data; - struct server_id pid = messaging_server_id(fsp->conn->sconn->msg_ctx); uint32_t i; for (i=0; inum_share_modes; i++) { @@ -886,7 +887,7 @@ static struct share_mode_entry *find_share_mode_entry( if (!serverid_equal(&pid, &e->pid)) { continue; } - if (fsp->fh->gen_id != e->share_file_id) { + if (share_file_id != e->share_file_id) { continue; } return e; @@ -902,7 +903,10 @@ bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp) { struct share_mode_entry *e; - e = find_share_mode_entry(lck, fsp); + e = find_share_mode_entry( + lck, + messaging_server_id(fsp->conn->sconn->msg_ctx), + fsp->fh->gen_id); if (e == NULL) { return False; } @@ -929,7 +933,10 @@ bool mark_share_mode_disconnected(struct share_mode_lock *lck, return false; } - e = find_share_mode_entry(lck, fsp); + e = find_share_mode_entry( + lck, + messaging_server_id(fsp->conn->sconn->msg_ctx), + fsp->fh->gen_id); if (e == NULL) { return false; } @@ -957,7 +964,10 @@ bool remove_share_oplock(struct share_mode_lock *lck, files_struct *fsp) struct share_mode_data *d = lck->data; struct share_mode_entry *e; - e = find_share_mode_entry(lck, fsp); + e = find_share_mode_entry( + lck, + messaging_server_id(fsp->conn->sconn->msg_ctx), + fsp->fh->gen_id); if (e == NULL) { return False; } @@ -975,7 +985,10 @@ bool downgrade_share_oplock(struct share_mode_lock *lck, files_struct *fsp) { struct share_mode_entry *e; - e = find_share_mode_entry(lck, fsp); + e = find_share_mode_entry( + lck, + messaging_server_id(fsp->conn->sconn->msg_ctx), + fsp->fh->gen_id); if (e == NULL) { return False; }