mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
s3:smbd: inline fsp_lease_type_is_exclusive() logic into contend_level2_oplocks_begin_default
SMB2_LEASE_WRITE is the indication for an exclusive lease, the fact that a SMB2_LEASE_WRITE can't exists without SMB2_LEASE_READ is not important here. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
bf8f225849
commit
76da56aa65
@ -71,23 +71,6 @@ uint32_t fsp_lease_type(struct files_struct *fsp)
|
||||
return fsp->lease_type;
|
||||
}
|
||||
|
||||
static uint32_t lease_type_is_exclusive(uint32_t lease_type)
|
||||
{
|
||||
if ((lease_type & (SMB2_LEASE_READ | SMB2_LEASE_WRITE)) ==
|
||||
(SMB2_LEASE_READ | SMB2_LEASE_WRITE)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool fsp_lease_type_is_exclusive(struct files_struct *fsp)
|
||||
{
|
||||
uint32_t lease_type = fsp_lease_type(fsp);
|
||||
|
||||
return lease_type_is_exclusive(lease_type);
|
||||
}
|
||||
|
||||
const struct GUID *fsp_client_guid(const files_struct *fsp)
|
||||
{
|
||||
return &fsp->conn->sconn->client->global->client_guid;
|
||||
|
@ -210,7 +210,6 @@ bool release_posix_lock_posix_flavour(files_struct *fsp,
|
||||
/* The following definitions come from locking/leases_util.c */
|
||||
uint32_t map_oplock_to_lease_type(uint16_t op_type);
|
||||
uint32_t fsp_lease_type(struct files_struct *fsp);
|
||||
bool fsp_lease_type_is_exclusive(struct files_struct *fsp);
|
||||
const struct GUID *fsp_client_guid(const files_struct *fsp);
|
||||
|
||||
#endif /* _LOCKING_PROTO_H_ */
|
||||
|
@ -1248,6 +1248,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
|
||||
.sconn = fsp->conn->sconn, .id = fsp->file_id,
|
||||
};
|
||||
struct share_mode_lock *lck = NULL;
|
||||
uint32_t fsp_lease = fsp_lease_type(fsp);
|
||||
bool ok, has_read_lease;
|
||||
|
||||
/*
|
||||
@ -1258,7 +1259,7 @@ static void contend_level2_oplocks_begin_default(files_struct *fsp,
|
||||
* the shared memory area whilst doing this.
|
||||
*/
|
||||
|
||||
if (fsp_lease_type_is_exclusive(fsp)) {
|
||||
if (fsp_lease & SMB2_LEASE_WRITE) {
|
||||
/*
|
||||
* There can't be any level2 oplocks, we're alone.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user