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>
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;
/* 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_ */
.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;
/*
* 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.
*/