summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2019-09-11 16:50:24 +0200
committerJeremy Allison <jra@samba.org>2019-09-17 22:49:38 +0000
commit2185db6c610433e0651543b7179cf1fbd0e2c9eb (patch)
tree774390a181047a98203d5b112727bc2ec7466809 /source3/locking
parentac119c411c4e268d7fe3c6766d3f9023ea4df456 (diff)
downloadsamba-2185db6c610433e0651543b7179cf1fbd0e2c9eb.tar.gz
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 <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/locking.c27
1 files changed, 20 insertions, 7 deletions
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; i<d->num_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;
}