mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:smbd: call grant_fsp_lease() after set_share_mode()
This means we don't have to call remove_lease_if_stale() if set_share_mode() fails. It's easier to cleanup the share mode entry. And it makes the code flow easier to the following changes. 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
aae504cdaa
commit
4d06aa1550
@ -4171,16 +4171,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
|
|||||||
if (oplock_type == LEASE_OPLOCK) {
|
if (oplock_type == LEASE_OPLOCK) {
|
||||||
lease_key = &lease->lease_key;
|
lease_key = &lease->lease_key;
|
||||||
|
|
||||||
status = grant_fsp_lease(fsp, lck, lease, granted_lease);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
TALLOC_FREE(lck);
|
|
||||||
fd_close(fsp);
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
fsp->oplock_type = oplock_type;
|
fsp->oplock_type = oplock_type;
|
||||||
|
|
||||||
DBG_DEBUG("lease_state=%d\n", fsp->lease->lease.lease_state);
|
|
||||||
} else if (oplock_type != NO_OPLOCK) {
|
} else if (oplock_type != NO_OPLOCK) {
|
||||||
|
|
||||||
fsp->oplock_type = oplock_type;
|
fsp->oplock_type = oplock_type;
|
||||||
@ -4206,22 +4198,23 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
|
|||||||
share_access,
|
share_access,
|
||||||
access_mask);
|
access_mask);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
if (fsp->oplock_type == LEASE_OPLOCK) {
|
|
||||||
status = remove_lease_if_stale(
|
|
||||||
lck,
|
|
||||||
fsp_client_guid(fsp),
|
|
||||||
&fsp->lease->lease.lease_key);
|
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
|
||||||
DBG_WARNING("remove_lease_if_stale "
|
|
||||||
"failed: %s\n",
|
|
||||||
nt_errstr(status));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TALLOC_FREE(lck);
|
TALLOC_FREE(lck);
|
||||||
fd_close(fsp);
|
fd_close(fsp);
|
||||||
return NT_STATUS_NO_MEMORY;
|
return NT_STATUS_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oplock_type == LEASE_OPLOCK) {
|
||||||
|
status = grant_fsp_lease(fsp, lck, lease, granted_lease);
|
||||||
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
|
del_share_mode(lck, fsp);
|
||||||
|
TALLOC_FREE(lck);
|
||||||
|
fd_close(fsp);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
DBG_DEBUG("lease_state=%d\n", fsp->lease->lease.lease_state);
|
||||||
|
}
|
||||||
|
|
||||||
/* Should we atomically (to the client at least) truncate ? */
|
/* Should we atomically (to the client at least) truncate ? */
|
||||||
if ((!new_file_created) &&
|
if ((!new_file_created) &&
|
||||||
(flags2 & O_TRUNC) &&
|
(flags2 & O_TRUNC) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user