From: Volker Lendecke Date: Tue, 10 Sep 2019 19:00:29 +0000 (+0200) Subject: smbd: Pass "struct file_id" to get_lease_type() X-Git-Tag: talloc-2.3.1~802 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=30e62710c6e323028555deb0eaee238c1713d7e9;p=thirdparty%2Fsamba.git smbd: Pass "struct file_id" to get_lease_type() It does not have to depend on the whole struct share_mode_data. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index da273fa8938..f714ccd29bd 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2204,7 +2204,7 @@ static NTSTATUS delay_for_oplock(files_struct *fsp, for (i=0; inum_share_modes; i++) { struct share_mode_entry *e = &d->share_modes[i]; bool e_is_lease = (e->op_type == LEASE_OPLOCK); - uint32_t e_lease_type = get_lease_type(d, e); + uint32_t e_lease_type = get_lease_type(e, d->id); uint32_t break_to; bool lease_is_breaking = false; @@ -4976,7 +4976,7 @@ static NTSTATUS lease_match(connection_struct *conn, d = lck->data; for (j=0; jnum_share_modes; j++) { struct share_mode_entry *e = &d->share_modes[j]; - uint32_t e_lease_type = get_lease_type(d, e); + uint32_t e_lease_type = get_lease_type(e, d->id); if (share_mode_stale_pid(d, j)) { continue; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 4461761ee48..3c57e0a99f2 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -174,8 +174,7 @@ static void downgrade_file_oplock(files_struct *fsp) TALLOC_FREE(fsp->oplock_timeout); } -uint32_t get_lease_type(const struct share_mode_data *d, - const struct share_mode_entry *e) +uint32_t get_lease_type(const struct share_mode_entry *e, struct file_id id) { if (e->op_type == LEASE_OPLOCK) { NTSTATUS status; @@ -184,7 +183,7 @@ uint32_t get_lease_type(const struct share_mode_data *d, status = leases_db_get( &e->client_guid, &e->lease_key, - &d->id, + &id, ¤t_state, NULL, /* breaking */ NULL, /* breaking_to_requested */ diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index f1c374f652b..11c9dc0f8b1 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -710,8 +710,7 @@ NTSTATUS create_file_default(connection_struct *conn, /* The following definitions come from smbd/oplock.c */ -uint32_t get_lease_type(const struct share_mode_data *d, - const struct share_mode_entry *e); +uint32_t get_lease_type(const struct share_mode_entry *e, struct file_id id); void break_kernel_oplock(struct messaging_context *msg_ctx, files_struct *fsp); NTSTATUS set_file_oplock(files_struct *fsp); diff --git a/source3/smbd/smb2_setinfo.c b/source3/smbd/smb2_setinfo.c index 49b921cd092..47ac774f659 100644 --- a/source3/smbd/smb2_setinfo.c +++ b/source3/smbd/smb2_setinfo.c @@ -209,7 +209,7 @@ static struct tevent_req *delay_rename_for_lease_break(struct tevent_req *req, continue; } - e_lease_type = get_lease_type(d, e); + e_lease_type = get_lease_type(e, d->id); if (!(e_lease_type & SMB2_LEASE_HANDLE)) { continue;