bool will_overwrite;
uint32_t delay_mask;
bool first_open_attempt;
+ int info;
bool got_handle_lease;
bool got_oplock;
bool disallow_write_lease;
bool have_sharing_violation,
uint32_t create_disposition,
bool first_open_attempt,
+ int info,
int *poplock_type,
uint32_t *pgranted,
struct blocker_debug_state **blocker_debug_state)
.fsp = fsp,
.lease = lease,
.first_open_attempt = first_open_attempt,
+ .info = info,
};
uint32_t requested;
uint32_t granted;
}
}
- if (file_has_brlocks(fsp)) {
+ if (info != FILE_WAS_OVERWRITTEN && file_has_brlocks(fsp)) {
DBG_DEBUG("file %s has byte range locks\n",
fsp_str_dbg(fsp));
granted &= ~(SMB2_LEASE_READ | SMB2_LEASE_HANDLE);
int oplock_request,
const struct smb2_lease *lease,
bool first_open_attempt,
+ int info,
int *poplock_type,
uint32_t *pgranted,
struct blocker_debug_state **blocker_debug_state)
sharing_violation,
create_disposition,
first_open_attempt,
+ info,
poplock_type,
pgranted,
blocker_debug_state);
uint32_t share_access,
int oplock_request,
const struct smb2_lease *lease,
- bool first_open_attempt)
+ bool first_open_attempt,
+ int info)
{
NTSTATUS status;
int oplock_type = NO_OPLOCK;
oplock_request,
lease,
first_open_attempt,
+ info,
&oplock_type,
&granted_lease,
&blocker_debug_state);
int oplock_request;
const struct smb2_lease *lease;
bool first_open_attempt;
+ int info;
bool keep_locked;
NTSTATUS status;
share_mode_entry_prepare_unlock_fn_t cleanup_fn;
state->share_access,
state->oplock_request,
state->lease,
- state->first_open_attempt);
+ state->first_open_attempt,
+ state->info);
if (!NT_STATUS_IS_OK(state->status)) {
return;
}
} else {
if (flags & O_TRUNC) {
info = FILE_WAS_OVERWRITTEN;
- /*
- * We did not truncate the file yet, we're doing that
- * explicitly with SMB_VFS_FTRUNCATE() below under the
- * sharemode glock. For correct handling of RH leases in
- * the presence of byterange locks, the leases code
- * needs the "correct" filesize which should be 0 at
- * this place if we did the O_TRUNC at open() time.
- */
- fsp->fsp_name->st.st_ex_size = 0;
} else {
info = FILE_WAS_OPENED;
}
.oplock_request = oplock_request,
.lease = lease,
.first_open_attempt = first_open_attempt,
+ .info = info,
.keep_locked = keep_locked,
};