mirror of
https://github.com/samba-team/samba.git
synced 2025-11-06 08:23:50 +03:00
This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context.
Jeremy.
This commit is contained in:
@@ -36,7 +36,7 @@ enum brl_flavour {WINDOWS_LOCK = 0, POSIX_LOCK = 1};
|
||||
this client */
|
||||
|
||||
struct lock_context {
|
||||
uint32 smbpid;
|
||||
uint64_t smblctx;
|
||||
uint16 tid;
|
||||
struct server_id pid;
|
||||
};
|
||||
@@ -88,8 +88,8 @@ struct blocking_lock_record {
|
||||
int lock_num;
|
||||
uint64_t offset;
|
||||
uint64_t count;
|
||||
uint32_t lock_pid;
|
||||
uint32_t blocking_pid; /* PID that blocks us. */
|
||||
uint64_t smblctx;
|
||||
uint64_t blocking_smblctx; /* Context that blocks us. */
|
||||
enum brl_flavour lock_flav;
|
||||
enum brl_type lock_type;
|
||||
struct smb_request *req;
|
||||
@@ -97,7 +97,7 @@ struct blocking_lock_record {
|
||||
};
|
||||
|
||||
struct smbd_lock_element {
|
||||
uint32_t smbpid;
|
||||
uint64_t smblctx;
|
||||
enum brl_type brltype;
|
||||
uint64_t offset;
|
||||
uint64_t count;
|
||||
|
||||
@@ -3374,18 +3374,18 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
|
||||
|
||||
NTSTATUS brl_lock(struct messaging_context *msg_ctx,
|
||||
struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
bool blocking_lock,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
struct blocking_lock_record *blr);
|
||||
bool brl_unlock(struct messaging_context *msg_ctx,
|
||||
struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
@@ -3394,21 +3394,21 @@ bool brl_unlock_windows_default(struct messaging_context *msg_ctx,
|
||||
struct byte_range_lock *br_lck,
|
||||
const struct lock_struct *plock);
|
||||
bool brl_locktest(struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav);
|
||||
NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
struct server_id pid,
|
||||
br_off *pstart,
|
||||
br_off *psize,
|
||||
enum brl_type *plock_type,
|
||||
enum brl_flavour lock_flav);
|
||||
bool brl_lock_cancel(struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
@@ -3434,7 +3434,7 @@ void brl_register_msgs(struct messaging_context *msg_ctx);
|
||||
const char *lock_type_name(enum brl_type lock_type);
|
||||
const char *lock_flav_name(enum brl_flavour lock_flav);
|
||||
void init_strict_lock_struct(files_struct *fsp,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
br_off start,
|
||||
br_off size,
|
||||
enum brl_type lock_type,
|
||||
@@ -3444,30 +3444,30 @@ bool strict_lock_default(files_struct *fsp,
|
||||
void strict_unlock_default(files_struct *fsp,
|
||||
struct lock_struct *plock);
|
||||
NTSTATUS query_lock(files_struct *fsp,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
uint64_t *pcount,
|
||||
uint64_t *poffset,
|
||||
enum brl_type *plock_type,
|
||||
enum brl_flavour lock_flav);
|
||||
struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
|
||||
files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
bool blocking_lock,
|
||||
NTSTATUS *perr,
|
||||
uint32 *plock_pid,
|
||||
uint64_t *psmblctx,
|
||||
struct blocking_lock_record *blr);
|
||||
NTSTATUS do_unlock(struct messaging_context *msg_ctx,
|
||||
files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_flavour lock_flav);
|
||||
NTSTATUS do_lock_cancel(files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64 smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_flavour lock_flav,
|
||||
@@ -5997,19 +5997,19 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
|
||||
files_struct *fsp,
|
||||
int lock_timeout,
|
||||
int lock_num,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
uint32 blocking_pid);
|
||||
uint64_t blocking_smblctx);
|
||||
void cancel_pending_lock_requests_by_fid(files_struct *fsp,
|
||||
struct byte_range_lock *br_lck,
|
||||
enum file_close_type close_type);
|
||||
void remove_pending_lock_requests_by_mid_smb1(uint64_t mid);
|
||||
bool blocking_lock_was_deferred_smb1(uint64_t mid);
|
||||
struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
enum brl_flavour lock_flav,
|
||||
@@ -6868,7 +6868,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
|
||||
int count,
|
||||
bool target_is_directory);
|
||||
void reply_copy(struct smb_request *req);
|
||||
uint32 get_lock_pid(const uint8_t *data, int data_offset,
|
||||
uint64_t get_lock_pid(const uint8_t *data, int data_offset,
|
||||
bool large_file_format);
|
||||
uint64_t get_lock_count(const uint8_t *data, int data_offset,
|
||||
bool large_file_format);
|
||||
|
||||
@@ -42,9 +42,9 @@ static struct db_context *brlock_db;
|
||||
|
||||
static void print_lock_struct(unsigned int i, struct lock_struct *pls)
|
||||
{
|
||||
DEBUG(10,("[%u]: smbpid = %u, tid = %u, pid = %s, ",
|
||||
DEBUG(10,("[%u]: smblctx = %llu, tid = %u, pid = %s, ",
|
||||
i,
|
||||
(unsigned int)pls->context.smbpid,
|
||||
(unsigned long long)pls->context.smblctx,
|
||||
(unsigned int)pls->context.tid,
|
||||
procid_str(talloc_tos(), &pls->context.pid) ));
|
||||
|
||||
@@ -64,7 +64,7 @@ bool brl_same_context(const struct lock_context *ctx1,
|
||||
const struct lock_context *ctx2)
|
||||
{
|
||||
return (procid_equal(&ctx1->pid, &ctx2->pid) &&
|
||||
(ctx1->smbpid == ctx2->smbpid) &&
|
||||
(ctx1->smblctx == ctx2->smblctx) &&
|
||||
(ctx1->tid == ctx2->tid));
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
|
||||
/* Do any Windows or POSIX locks conflict ? */
|
||||
if (brl_conflict(&locks[i], plock)) {
|
||||
/* Remember who blocked us. */
|
||||
plock->context.smbpid = locks[i].context.smbpid;
|
||||
plock->context.smblctx = locks[i].context.smblctx;
|
||||
return brl_lock_failed(fsp,plock,blocking_lock);
|
||||
}
|
||||
#if ZERO_ZERO
|
||||
@@ -373,7 +373,7 @@ NTSTATUS brl_lock_windows_default(struct byte_range_lock *br_lck,
|
||||
&errno_ret)) {
|
||||
|
||||
/* We don't know who blocked us. */
|
||||
plock->context.smbpid = 0xFFFFFFFF;
|
||||
plock->context.smblctx = 0xFFFFFFFFFFFFFFFFLL;
|
||||
|
||||
if (errno_ret == EACCES || errno_ret == EAGAIN) {
|
||||
status = NT_STATUS_FILE_LOCK_CONFLICT;
|
||||
@@ -747,7 +747,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
|
||||
/* No games with error messages. */
|
||||
SAFE_FREE(tp);
|
||||
/* Remember who blocked us. */
|
||||
plock->context.smbpid = curr_lock->context.smbpid;
|
||||
plock->context.smblctx = curr_lock->context.smblctx;
|
||||
return NT_STATUS_FILE_LOCK_CONFLICT;
|
||||
}
|
||||
/* Just copy the Windows lock into the new array. */
|
||||
@@ -762,7 +762,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
|
||||
/* No games with error messages. */
|
||||
SAFE_FREE(tp);
|
||||
/* Remember who blocked us. */
|
||||
plock->context.smbpid = curr_lock->context.smbpid;
|
||||
plock->context.smblctx = curr_lock->context.smblctx;
|
||||
return NT_STATUS_FILE_LOCK_CONFLICT;
|
||||
}
|
||||
|
||||
@@ -822,7 +822,7 @@ static NTSTATUS brl_lock_posix(struct messaging_context *msg_ctx,
|
||||
&errno_ret)) {
|
||||
|
||||
/* We don't know who blocked us. */
|
||||
plock->context.smbpid = 0xFFFFFFFF;
|
||||
plock->context.smblctx = 0xFFFFFFFFFFFFFFFFLL;
|
||||
|
||||
if (errno_ret == EACCES || errno_ret == EAGAIN) {
|
||||
SAFE_FREE(tp);
|
||||
@@ -902,14 +902,14 @@ NTSTATUS smb_vfs_call_brl_lock_windows(struct vfs_handle_struct *handle,
|
||||
|
||||
NTSTATUS brl_lock(struct messaging_context *msg_ctx,
|
||||
struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
bool blocking_lock,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
struct blocking_lock_record *blr)
|
||||
{
|
||||
NTSTATUS ret;
|
||||
@@ -926,7 +926,7 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx,
|
||||
memset(&lock, '\0', sizeof(lock));
|
||||
#endif
|
||||
|
||||
lock.context.smbpid = smbpid;
|
||||
lock.context.smblctx = smblctx;
|
||||
lock.context.pid = pid;
|
||||
lock.context.tid = br_lck->fsp->conn->cnum;
|
||||
lock.start = start;
|
||||
@@ -948,8 +948,8 @@ NTSTATUS brl_lock(struct messaging_context *msg_ctx,
|
||||
#endif
|
||||
|
||||
/* If we're returning an error, return who blocked us. */
|
||||
if (!NT_STATUS_IS_OK(ret) && psmbpid) {
|
||||
*psmbpid = lock.context.smbpid;
|
||||
if (!NT_STATUS_IS_OK(ret) && psmblctx) {
|
||||
*psmblctx = lock.context.smblctx;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1235,7 +1235,7 @@ bool smb_vfs_call_brl_unlock_windows(struct vfs_handle_struct *handle,
|
||||
|
||||
bool brl_unlock(struct messaging_context *msg_ctx,
|
||||
struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
@@ -1243,7 +1243,7 @@ bool brl_unlock(struct messaging_context *msg_ctx,
|
||||
{
|
||||
struct lock_struct lock;
|
||||
|
||||
lock.context.smbpid = smbpid;
|
||||
lock.context.smblctx = smblctx;
|
||||
lock.context.pid = pid;
|
||||
lock.context.tid = br_lck->fsp->conn->cnum;
|
||||
lock.start = start;
|
||||
@@ -1266,7 +1266,7 @@ bool brl_unlock(struct messaging_context *msg_ctx,
|
||||
****************************************************************************/
|
||||
|
||||
bool brl_locktest(struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
@@ -1279,7 +1279,7 @@ bool brl_locktest(struct byte_range_lock *br_lck,
|
||||
const struct lock_struct *locks = br_lck->lock_data;
|
||||
files_struct *fsp = br_lck->fsp;
|
||||
|
||||
lock.context.smbpid = smbpid;
|
||||
lock.context.smblctx = smblctx;
|
||||
lock.context.pid = pid;
|
||||
lock.context.tid = br_lck->fsp->conn->cnum;
|
||||
lock.start = start;
|
||||
@@ -1324,7 +1324,7 @@ bool brl_locktest(struct byte_range_lock *br_lck,
|
||||
****************************************************************************/
|
||||
|
||||
NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
struct server_id pid,
|
||||
br_off *pstart,
|
||||
br_off *psize,
|
||||
@@ -1336,7 +1336,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
|
||||
const struct lock_struct *locks = br_lck->lock_data;
|
||||
files_struct *fsp = br_lck->fsp;
|
||||
|
||||
lock.context.smbpid = *psmbpid;
|
||||
lock.context.smblctx = *psmblctx;
|
||||
lock.context.pid = pid;
|
||||
lock.context.tid = br_lck->fsp->conn->cnum;
|
||||
lock.start = *pstart;
|
||||
@@ -1357,7 +1357,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
|
||||
}
|
||||
|
||||
if (conflict) {
|
||||
*psmbpid = exlock->context.smbpid;
|
||||
*psmblctx = exlock->context.smblctx;
|
||||
*pstart = exlock->start;
|
||||
*psize = exlock->size;
|
||||
*plock_type = exlock->lock_type;
|
||||
@@ -1378,8 +1378,8 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
|
||||
fsp->fnum, fsp_str_dbg(fsp)));
|
||||
|
||||
if (ret) {
|
||||
/* Hmmm. No clue what to set smbpid to - use -1. */
|
||||
*psmbpid = 0xFFFF;
|
||||
/* Hmmm. No clue what to set smblctx to - use -1. */
|
||||
*psmblctx = 0xFFFFFFFFFFFFFFFFLL;
|
||||
return NT_STATUS_LOCK_NOT_GRANTED;
|
||||
}
|
||||
}
|
||||
@@ -1401,7 +1401,7 @@ bool smb_vfs_call_brl_cancel_windows(struct vfs_handle_struct *handle,
|
||||
Remove a particular pending lock.
|
||||
****************************************************************************/
|
||||
bool brl_lock_cancel(struct byte_range_lock *br_lck,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
struct server_id pid,
|
||||
br_off start,
|
||||
br_off size,
|
||||
@@ -1411,7 +1411,7 @@ bool brl_lock_cancel(struct byte_range_lock *br_lck,
|
||||
bool ret;
|
||||
struct lock_struct lock;
|
||||
|
||||
lock.context.smbpid = smbpid;
|
||||
lock.context.smblctx = smblctx;
|
||||
lock.context.pid = pid;
|
||||
lock.context.tid = br_lck->fsp->conn->cnum;
|
||||
lock.start = start;
|
||||
@@ -1533,7 +1533,7 @@ void brl_close_fnum(struct messaging_context *msg_ctx,
|
||||
(lock->fnum == fnum)) {
|
||||
brl_unlock(msg_ctx,
|
||||
br_lck,
|
||||
lock->context.smbpid,
|
||||
lock->context.smblctx,
|
||||
pid,
|
||||
lock->start,
|
||||
lock->size,
|
||||
@@ -1646,7 +1646,7 @@ static bool validate_lock_entries(unsigned int *pnum_entries, struct lock_struct
|
||||
num_valid_entries = 0;
|
||||
for (i = 0; i < *pnum_entries; i++) {
|
||||
struct lock_struct *lock_data = &locks[i];
|
||||
if (lock_data->context.smbpid &&
|
||||
if (lock_data->context.smblctx &&
|
||||
lock_data->context.tid) {
|
||||
/* Valid (nonzero) entry - copy it. */
|
||||
memcpy(&new_lock_data[num_valid_entries],
|
||||
|
||||
@@ -77,7 +77,7 @@ const char *lock_flav_name(enum brl_flavour lock_flav)
|
||||
****************************************************************************/
|
||||
|
||||
void init_strict_lock_struct(files_struct *fsp,
|
||||
uint32 smbpid,
|
||||
uint64_t smblctx,
|
||||
br_off start,
|
||||
br_off size,
|
||||
enum brl_type lock_type,
|
||||
@@ -85,7 +85,7 @@ void init_strict_lock_struct(files_struct *fsp,
|
||||
{
|
||||
SMB_ASSERT(lock_type == READ_LOCK || lock_type == WRITE_LOCK);
|
||||
|
||||
plock->context.smbpid = smbpid;
|
||||
plock->context.smblctx = smblctx;
|
||||
plock->context.tid = fsp->conn->cnum;
|
||||
plock->context.pid = procid_self();
|
||||
plock->start = start;
|
||||
@@ -124,7 +124,7 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
|
||||
return True;
|
||||
}
|
||||
ret = brl_locktest(br_lck,
|
||||
plock->context.smbpid,
|
||||
plock->context.smblctx,
|
||||
plock->context.pid,
|
||||
plock->start,
|
||||
plock->size,
|
||||
@@ -139,7 +139,7 @@ bool strict_lock_default(files_struct *fsp, struct lock_struct *plock)
|
||||
return True;
|
||||
}
|
||||
ret = brl_locktest(br_lck,
|
||||
plock->context.smbpid,
|
||||
plock->context.smblctx,
|
||||
plock->context.pid,
|
||||
plock->start,
|
||||
plock->size,
|
||||
@@ -166,7 +166,7 @@ void strict_unlock_default(files_struct *fsp, struct lock_struct *plock)
|
||||
****************************************************************************/
|
||||
|
||||
NTSTATUS query_lock(files_struct *fsp,
|
||||
uint32 *psmbpid,
|
||||
uint64_t *psmblctx,
|
||||
uint64_t *pcount,
|
||||
uint64_t *poffset,
|
||||
enum brl_type *plock_type,
|
||||
@@ -188,7 +188,7 @@ NTSTATUS query_lock(files_struct *fsp,
|
||||
}
|
||||
|
||||
return brl_lockquery(br_lck,
|
||||
psmbpid,
|
||||
psmblctx,
|
||||
procid_self(),
|
||||
poffset,
|
||||
pcount,
|
||||
@@ -230,14 +230,14 @@ static void decrement_current_lock_count(files_struct *fsp,
|
||||
|
||||
struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
|
||||
files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
bool blocking_lock,
|
||||
NTSTATUS *perr,
|
||||
uint32 *plock_pid,
|
||||
uint64_t *psmblctx,
|
||||
struct blocking_lock_record *blr)
|
||||
{
|
||||
struct byte_range_lock *br_lck = NULL;
|
||||
@@ -274,14 +274,14 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
|
||||
|
||||
*perr = brl_lock(msg_ctx,
|
||||
br_lck,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
procid_self(),
|
||||
offset,
|
||||
count,
|
||||
lock_type,
|
||||
lock_flav,
|
||||
blocking_lock,
|
||||
plock_pid,
|
||||
psmblctx,
|
||||
blr);
|
||||
|
||||
DEBUG(10, ("do_lock: returning status=%s\n", nt_errstr(*perr)));
|
||||
@@ -296,7 +296,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx,
|
||||
|
||||
NTSTATUS do_unlock(struct messaging_context *msg_ctx,
|
||||
files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_flavour lock_flav)
|
||||
@@ -323,7 +323,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
|
||||
|
||||
ok = brl_unlock(msg_ctx,
|
||||
br_lck,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
procid_self(),
|
||||
offset,
|
||||
count,
|
||||
@@ -345,7 +345,7 @@ NTSTATUS do_unlock(struct messaging_context *msg_ctx,
|
||||
****************************************************************************/
|
||||
|
||||
NTSTATUS do_lock_cancel(files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64 smblctx,
|
||||
uint64_t count,
|
||||
uint64_t offset,
|
||||
enum brl_flavour lock_flav,
|
||||
@@ -373,7 +373,7 @@ NTSTATUS do_lock_cancel(files_struct *fsp,
|
||||
}
|
||||
|
||||
ok = brl_lock_cancel(br_lck,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
procid_self(),
|
||||
offset,
|
||||
count,
|
||||
|
||||
@@ -206,7 +206,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
|
||||
srv_set_message(aio_ex->outbuf, 12, 0, True);
|
||||
SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
|
||||
&aio_ex->lock);
|
||||
|
||||
@@ -315,7 +315,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
|
||||
srv_set_message(aio_ex->outbuf, 6, 0, True);
|
||||
SCVAL(aio_ex->outbuf,smb_vwv0,0xFF); /* Never a chained reply. */
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
|
||||
&aio_ex->lock);
|
||||
|
||||
|
||||
@@ -90,11 +90,11 @@ static bool recalc_brl_timeout(void)
|
||||
for (blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = blr->next) {
|
||||
if (timeval_is_zero(&blr->expire_time)) {
|
||||
/*
|
||||
* If we're blocked on pid 0xFFFFFFFF this is
|
||||
* If we're blocked on pid 0xFFFFFFFFFFFFFFFFLL this is
|
||||
* a POSIX lock, so calculate a timeout of
|
||||
* 10 seconds into the future.
|
||||
*/
|
||||
if (blr->blocking_pid == 0xFFFFFFFF) {
|
||||
if (blr->blocking_smblctx == 0xFFFFFFFFFFFFFFFFLL) {
|
||||
struct timeval psx_to = timeval_current_ofs(10, 0);
|
||||
next_timeout = timeval_brl_min(&next_timeout, &psx_to);
|
||||
}
|
||||
@@ -157,12 +157,12 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
|
||||
files_struct *fsp,
|
||||
int lock_timeout,
|
||||
int lock_num,
|
||||
uint32_t lock_pid,
|
||||
uint64_t smblctx,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
uint32_t blocking_pid)
|
||||
uint64_t blocking_smblctx)
|
||||
{
|
||||
struct smbd_server_connection *sconn = smbd_server_conn;
|
||||
struct blocking_lock_record *blr;
|
||||
@@ -174,12 +174,12 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
|
||||
fsp,
|
||||
lock_timeout,
|
||||
lock_num,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
lock_type,
|
||||
lock_flav,
|
||||
offset,
|
||||
count,
|
||||
blocking_pid);
|
||||
blocking_smblctx);
|
||||
}
|
||||
|
||||
if(req_is_in_chain(req)) {
|
||||
@@ -210,8 +210,8 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
|
||||
(lock_timeout % 1000) * 1000);
|
||||
}
|
||||
blr->lock_num = lock_num;
|
||||
blr->lock_pid = lock_pid;
|
||||
blr->blocking_pid = blocking_pid;
|
||||
blr->smblctx = smblctx;
|
||||
blr->blocking_smblctx = blocking_smblctx;
|
||||
blr->lock_flav = lock_flav;
|
||||
blr->lock_type = lock_type;
|
||||
blr->offset = offset;
|
||||
@@ -223,7 +223,7 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
|
||||
/* Add a pending lock record for this. */
|
||||
status = brl_lock(smbd_messaging_context(),
|
||||
br_lck,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
procid_self(),
|
||||
offset,
|
||||
count,
|
||||
@@ -298,7 +298,7 @@ static void generic_blocking_lock_error(struct blocking_lock_record *blr, NTSTAT
|
||||
files_struct *fsp = blr->fsp;
|
||||
|
||||
if (fsp) {
|
||||
fsp->last_lock_failure.context.smbpid = blr->lock_pid;
|
||||
fsp->last_lock_failure.context.smblctx = blr->smblctx;
|
||||
fsp->last_lock_failure.context.tid = fsp->conn->cnum;
|
||||
fsp->last_lock_failure.context.pid = procid_self();
|
||||
fsp->last_lock_failure.start = blr->offset;
|
||||
@@ -328,7 +328,7 @@ static void reply_lockingX_error(struct blocking_lock_record *blr, NTSTATUS stat
|
||||
files_struct *fsp = blr->fsp;
|
||||
uint16 num_ulocks = SVAL(blr->req->vwv+6, 0);
|
||||
uint64_t count = (uint64_t)0, offset = (uint64_t) 0;
|
||||
uint32 lock_pid;
|
||||
uint64_t smblctx;
|
||||
unsigned char locktype = CVAL(blr->req->vwv+3, 0);
|
||||
bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
|
||||
uint8_t *data;
|
||||
@@ -351,7 +351,7 @@ static void reply_lockingX_error(struct blocking_lock_record *blr, NTSTATUS stat
|
||||
for(i = blr->lock_num - 1; i >= 0; i--) {
|
||||
bool err;
|
||||
|
||||
lock_pid = get_lock_pid( data, i, large_file_format);
|
||||
smblctx = get_lock_pid( data, i, large_file_format);
|
||||
count = get_lock_count( data, i, large_file_format);
|
||||
offset = get_lock_offset( data, i, large_file_format, &err);
|
||||
|
||||
@@ -362,7 +362,7 @@ static void reply_lockingX_error(struct blocking_lock_record *blr, NTSTATUS stat
|
||||
|
||||
do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
count,
|
||||
offset,
|
||||
WINDOWS_LOCK);
|
||||
@@ -421,7 +421,7 @@ static bool process_lockingX(struct blocking_lock_record *blr)
|
||||
uint16 num_ulocks = SVAL(blr->req->vwv+6, 0);
|
||||
uint16 num_locks = SVAL(blr->req->vwv+7, 0);
|
||||
uint64_t count = (uint64_t)0, offset = (uint64_t)0;
|
||||
uint32 lock_pid;
|
||||
uint64_t smblctx;
|
||||
bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
|
||||
uint8_t *data;
|
||||
NTSTATUS status = NT_STATUS_OK;
|
||||
@@ -438,7 +438,7 @@ static bool process_lockingX(struct blocking_lock_record *blr)
|
||||
struct byte_range_lock *br_lck = NULL;
|
||||
bool err;
|
||||
|
||||
lock_pid = get_lock_pid( data, blr->lock_num, large_file_format);
|
||||
smblctx = get_lock_pid( data, blr->lock_num, large_file_format);
|
||||
count = get_lock_count( data, blr->lock_num, large_file_format);
|
||||
offset = get_lock_offset( data, blr->lock_num, large_file_format, &err);
|
||||
|
||||
@@ -449,7 +449,7 @@ static bool process_lockingX(struct blocking_lock_record *blr)
|
||||
errno = 0;
|
||||
br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
count,
|
||||
offset,
|
||||
((locktype & LOCKING_ANDX_SHARED_LOCK) ?
|
||||
@@ -457,7 +457,7 @@ static bool process_lockingX(struct blocking_lock_record *blr)
|
||||
WINDOWS_LOCK,
|
||||
True,
|
||||
&status,
|
||||
&blr->blocking_pid,
|
||||
&blr->blocking_smblctx,
|
||||
blr);
|
||||
|
||||
TALLOC_FREE(br_lck);
|
||||
@@ -513,14 +513,14 @@ static bool process_trans2(struct blocking_lock_record *blr)
|
||||
NTSTATUS status;
|
||||
struct byte_range_lock *br_lck = do_lock(smbd_messaging_context(),
|
||||
blr->fsp,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
blr->count,
|
||||
blr->offset,
|
||||
blr->lock_type,
|
||||
blr->lock_flav,
|
||||
True,
|
||||
&status,
|
||||
&blr->blocking_pid,
|
||||
&blr->blocking_smblctx,
|
||||
blr);
|
||||
TALLOC_FREE(br_lck);
|
||||
|
||||
@@ -602,7 +602,7 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp,
|
||||
blr->req->cmd, fsp_str_dbg(fsp), fsp->fnum));
|
||||
|
||||
blr_cancelled = blocking_lock_cancel_smb1(fsp,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
blr->offset,
|
||||
blr->count,
|
||||
blr->lock_flav,
|
||||
@@ -612,7 +612,7 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp,
|
||||
SMB_ASSERT(blr_cancelled == blr);
|
||||
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
@@ -655,7 +655,7 @@ void remove_pending_lock_requests_by_mid_smb1(uint64_t mid)
|
||||
fsp->fnum ));
|
||||
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
@@ -751,7 +751,7 @@ void process_blocking_lock_queue(void)
|
||||
|
||||
if (br_lck) {
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
@@ -788,7 +788,7 @@ void process_blocking_lock_queue(void)
|
||||
fsp_str_dbg(blr->fsp)));
|
||||
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
@@ -851,7 +851,7 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
|
||||
*****************************************************************************/
|
||||
|
||||
struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
|
||||
uint32 lock_pid,
|
||||
uint64_t smblctx,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
enum brl_flavour lock_flav,
|
||||
@@ -873,7 +873,7 @@ struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
|
||||
|
||||
for (blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = blr->next) {
|
||||
if (fsp == blr->fsp &&
|
||||
lock_pid == blr->lock_pid &&
|
||||
smblctx == blr->smblctx &&
|
||||
offset == blr->offset &&
|
||||
count == blr->count &&
|
||||
lock_flav == blr->lock_flav) {
|
||||
|
||||
@@ -312,12 +312,12 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
|
||||
files_struct *fsp,
|
||||
int lock_timeout,
|
||||
int lock_num,
|
||||
uint32_t lock_pid,
|
||||
uint64_t smblctx,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
uint32_t blocking_pid);
|
||||
uint64_t blocking_smblctx);
|
||||
void process_blocking_lock_queue_smb2(struct timeval tv_curr);
|
||||
void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
|
||||
struct byte_range_lock *br_lck,
|
||||
|
||||
@@ -3146,7 +3146,7 @@ void reply_readbraw(struct smb_request *req)
|
||||
/* ensure we don't overrun the packet size */
|
||||
maxcount = MIN(65535,maxcount);
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)maxcount, READ_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -3248,7 +3248,7 @@ void reply_lockread(struct smb_request *req)
|
||||
|
||||
br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
req->smbpid,
|
||||
(uint64_t)req->smbpid,
|
||||
(uint64_t)numtoread,
|
||||
(uint64_t)startpos,
|
||||
WRITE_LOCK,
|
||||
@@ -3359,7 +3359,7 @@ Returning short read of maximum allowed for compatibility with Windows 2000.\n",
|
||||
|
||||
data = smb_buf(req->outbuf) + 3;
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtoread, READ_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -3441,7 +3441,7 @@ static void send_file_readX(connection_struct *conn, struct smb_request *req,
|
||||
return;
|
||||
}
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -3833,7 +3833,7 @@ void reply_writebraw(struct smb_request *req)
|
||||
}
|
||||
|
||||
if (!fsp->print_file) {
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -4035,7 +4035,7 @@ void reply_writeunlock(struct smb_request *req)
|
||||
data = (const char *)req->buf + 3;
|
||||
|
||||
if (!fsp->print_file && numtowrite > 0) {
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -4077,7 +4077,7 @@ void reply_writeunlock(struct smb_request *req)
|
||||
if (numtowrite && !fsp->print_file) {
|
||||
status = do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
req->smbpid,
|
||||
(uint64_t)req->smbpid,
|
||||
(uint64_t)numtowrite,
|
||||
(uint64_t)startpos,
|
||||
WINDOWS_LOCK);
|
||||
@@ -4156,7 +4156,7 @@ void reply_write(struct smb_request *req)
|
||||
data = (const char *)req->buf + 3;
|
||||
|
||||
if (!fsp->print_file) {
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -4456,7 +4456,7 @@ void reply_write_and_X(struct smb_request *req)
|
||||
/* NT_STATUS_RETRY - fall through to sync write. */
|
||||
}
|
||||
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -4774,7 +4774,7 @@ void reply_writeclose(struct smb_request *req)
|
||||
data = (const char *)req->buf + 1;
|
||||
|
||||
if (!fsp->print_file) {
|
||||
init_strict_lock_struct(fsp, (uint32)req->smbpid,
|
||||
init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
|
||||
(uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
|
||||
&lock);
|
||||
|
||||
@@ -4865,7 +4865,7 @@ void reply_lock(struct smb_request *req)
|
||||
|
||||
br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
req->smbpid,
|
||||
(uint64_t)req->smbpid,
|
||||
count,
|
||||
offset,
|
||||
WRITE_LOCK,
|
||||
@@ -4920,7 +4920,7 @@ void reply_unlock(struct smb_request *req)
|
||||
|
||||
status = do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
req->smbpid,
|
||||
(uint64_t)req->smbpid,
|
||||
count,
|
||||
offset,
|
||||
WINDOWS_LOCK);
|
||||
@@ -6933,13 +6933,13 @@ void reply_copy(struct smb_request *req)
|
||||
Get a lock pid, dealing with large count requests.
|
||||
****************************************************************************/
|
||||
|
||||
uint32 get_lock_pid(const uint8_t *data, int data_offset,
|
||||
uint64_t get_lock_pid(const uint8_t *data, int data_offset,
|
||||
bool large_file_format)
|
||||
{
|
||||
if(!large_file_format)
|
||||
return (uint32)SVAL(data,SMB_LPID_OFFSET(data_offset));
|
||||
return (uint64_t)SVAL(data,SMB_LPID_OFFSET(data_offset));
|
||||
else
|
||||
return (uint32)SVAL(data,SMB_LARGE_LPID_OFFSET(data_offset));
|
||||
return (uint64_t)SVAL(data,SMB_LARGE_LPID_OFFSET(data_offset));
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -7090,7 +7090,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
"pid %u, file %s\n",
|
||||
(double)e->offset,
|
||||
(double)e->count,
|
||||
(unsigned int)e->smbpid,
|
||||
(unsigned int)e->smblctx,
|
||||
fsp_str_dbg(fsp)));
|
||||
|
||||
if (e->brltype != UNLOCK_LOCK) {
|
||||
@@ -7100,7 +7100,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
|
||||
status = do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->count,
|
||||
e->offset,
|
||||
WINDOWS_LOCK);
|
||||
@@ -7125,11 +7125,11 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
for(i = 0; i < (int)num_locks; i++) {
|
||||
struct smbd_lock_element *e = &locks[i];
|
||||
|
||||
DEBUG(10,("smbd_do_locking: lock start=%.0f, len=%.0f for pid "
|
||||
"%u, file %s timeout = %d\n",
|
||||
DEBUG(10,("smbd_do_locking: lock start=%.0f, len=%.0f for smblctx "
|
||||
"%llu, file %s timeout = %d\n",
|
||||
(double)e->offset,
|
||||
(double)e->count,
|
||||
(unsigned int)e->smbpid,
|
||||
(unsigned long long)e->smblctx,
|
||||
fsp_str_dbg(fsp),
|
||||
(int)timeout));
|
||||
|
||||
@@ -7167,7 +7167,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
return the right error. */
|
||||
|
||||
blr = blocking_lock_cancel_smb1(fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->offset,
|
||||
e->count,
|
||||
WINDOWS_LOCK,
|
||||
@@ -7181,7 +7181,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
}
|
||||
/* Remove a matching pending lock. */
|
||||
status = do_lock_cancel(fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->count,
|
||||
e->offset,
|
||||
WINDOWS_LOCK,
|
||||
@@ -7190,18 +7190,18 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
bool blocking_lock = timeout ? true : false;
|
||||
bool defer_lock = false;
|
||||
struct byte_range_lock *br_lck;
|
||||
uint32_t block_smbpid;
|
||||
uint64_t block_smblctx;
|
||||
|
||||
br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->count,
|
||||
e->offset,
|
||||
e->brltype,
|
||||
WINDOWS_LOCK,
|
||||
blocking_lock,
|
||||
&status,
|
||||
&block_smbpid,
|
||||
&block_smblctx,
|
||||
NULL);
|
||||
|
||||
if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
|
||||
@@ -7244,12 +7244,12 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
fsp,
|
||||
timeout,
|
||||
i,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->brltype,
|
||||
WINDOWS_LOCK,
|
||||
e->offset,
|
||||
e->count,
|
||||
block_smbpid)) {
|
||||
block_smblctx)) {
|
||||
TALLOC_FREE(br_lck);
|
||||
*async = true;
|
||||
return NT_STATUS_OK;
|
||||
@@ -7283,7 +7283,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
|
||||
|
||||
do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->count,
|
||||
e->offset,
|
||||
WINDOWS_LOCK);
|
||||
@@ -7448,7 +7448,7 @@ void reply_lockingX(struct smb_request *req)
|
||||
/* Data now points at the beginning of the list
|
||||
of smb_unlkrng structs */
|
||||
for(i = 0; i < (int)num_ulocks; i++) {
|
||||
ulocks[i].smbpid = get_lock_pid(data, i, large_file_format);
|
||||
ulocks[i].smblctx = get_lock_pid(data, i, large_file_format);
|
||||
ulocks[i].count = get_lock_count(data, i, large_file_format);
|
||||
ulocks[i].offset = get_lock_offset(data, i, large_file_format, &err);
|
||||
ulocks[i].brltype = UNLOCK_LOCK;
|
||||
@@ -7470,7 +7470,7 @@ void reply_lockingX(struct smb_request *req)
|
||||
of smb_lkrng structs */
|
||||
|
||||
for(i = 0; i < (int)num_locks; i++) {
|
||||
locks[i].smbpid = get_lock_pid(data, i, large_file_format);
|
||||
locks[i].smblctx = get_lock_pid(data, i, large_file_format);
|
||||
locks[i].count = get_lock_count(data, i, large_file_format);
|
||||
locks[i].offset = get_lock_offset(data, i, large_file_format, &err);
|
||||
|
||||
|
||||
@@ -341,7 +341,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
|
||||
return tevent_req_post(req, ev);
|
||||
}
|
||||
|
||||
locks[i].smbpid = in_smbpid;
|
||||
locks[i].smblctx = in_smbpid;
|
||||
locks[i].offset = in_locks[i].offset;
|
||||
locks[i].count = in_locks[i].length;
|
||||
|
||||
@@ -362,11 +362,11 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
DEBUG(10,("smbd_smb2_lock_send: index %d offset=%llu, count=%llu, "
|
||||
"pid = %u type %d\n",
|
||||
"smblctx = %llu type %d\n",
|
||||
i,
|
||||
(unsigned long long)locks[i].offset,
|
||||
(unsigned long long)locks[i].count,
|
||||
(unsigned int)locks[i].smbpid,
|
||||
(unsigned long long)locks[i].smblctx,
|
||||
(int)locks[i].brltype ));
|
||||
|
||||
}
|
||||
@@ -510,11 +510,11 @@ static bool recalc_smb2_brl_timeout(struct smbd_server_connection *sconn)
|
||||
}
|
||||
if (timeval_is_zero(&blr->expire_time)) {
|
||||
/*
|
||||
* If we're blocked on pid 0xFFFFFFFF this is
|
||||
* If we're blocked on pid 0xFFFFFFFFFFFFFFFFLL this is
|
||||
* a POSIX lock, so calculate a timeout of
|
||||
* 10 seconds into the future.
|
||||
*/
|
||||
if (blr->blocking_pid == 0xFFFFFFFF) {
|
||||
if (blr->blocking_smblctx == 0xFFFFFFFFFFFFFFFFLL) {
|
||||
struct timeval psx_to = timeval_current_ofs(10, 0);
|
||||
next_timeout = timeval_brl_min(&next_timeout, &psx_to);
|
||||
}
|
||||
@@ -582,12 +582,12 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
|
||||
files_struct *fsp,
|
||||
int lock_timeout,
|
||||
int lock_num,
|
||||
uint32_t lock_pid,
|
||||
uint64_t smblctx,
|
||||
enum brl_type lock_type,
|
||||
enum brl_flavour lock_flav,
|
||||
uint64_t offset,
|
||||
uint64_t count,
|
||||
uint32_t blocking_pid)
|
||||
uint64_t blocking_smblctx)
|
||||
{
|
||||
struct smbd_server_connection *sconn = smbd_server_conn;
|
||||
struct smbd_smb2_request *smb2req = smb1req->smb2req;
|
||||
@@ -627,8 +627,8 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
|
||||
}
|
||||
|
||||
blr->lock_num = lock_num;
|
||||
blr->lock_pid = lock_pid;
|
||||
blr->blocking_pid = blocking_pid;
|
||||
blr->smblctx = smblctx;
|
||||
blr->blocking_smblctx = blocking_smblctx;
|
||||
blr->lock_flav = lock_flav;
|
||||
blr->lock_type = lock_type;
|
||||
blr->offset = offset;
|
||||
@@ -640,7 +640,7 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
|
||||
/* Add a pending lock record for this. */
|
||||
status = brl_lock(smbd_messaging_context(),
|
||||
br_lck,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
procid_self(),
|
||||
offset,
|
||||
count,
|
||||
@@ -690,7 +690,7 @@ static void remove_pending_lock(TALLOC_CTX *mem_ctx, struct blocking_lock_record
|
||||
|
||||
if (br_lck) {
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
@@ -732,14 +732,14 @@ static void reprocess_blocked_smb2_lock(struct smbd_smb2_request *smb2req,
|
||||
|
||||
br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
e->smbpid,
|
||||
e->smblctx,
|
||||
e->count,
|
||||
e->offset,
|
||||
e->brltype,
|
||||
WINDOWS_LOCK,
|
||||
true,
|
||||
&status,
|
||||
&blr->blocking_pid,
|
||||
&blr->blocking_smblctx,
|
||||
blr);
|
||||
|
||||
TALLOC_FREE(br_lck);
|
||||
@@ -897,7 +897,7 @@ void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
|
||||
|
||||
/* Remove the entries from the lock db. */
|
||||
brl_lock_cancel(br_lck,
|
||||
blr->lock_pid,
|
||||
blr->smblctx,
|
||||
procid_self(),
|
||||
blr->offset,
|
||||
blr->count,
|
||||
|
||||
@@ -4877,7 +4877,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
{
|
||||
uint64_t count;
|
||||
uint64_t offset;
|
||||
uint32 lock_pid;
|
||||
uint64_t smblctx;
|
||||
enum brl_type lock_type;
|
||||
|
||||
/* We need an open file with a real fd for this. */
|
||||
@@ -4902,7 +4902,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
return NT_STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
lock_pid = IVAL(pdata, POSIX_LOCK_PID_OFFSET);
|
||||
smblctx = (uint64_t)IVAL(pdata, POSIX_LOCK_PID_OFFSET);
|
||||
#if defined(HAVE_LONGLONG)
|
||||
offset = (((uint64_t) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
|
||||
((uint64_t) IVAL(pdata,POSIX_LOCK_START_OFFSET));
|
||||
@@ -4914,7 +4914,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
#endif /* HAVE_LONGLONG */
|
||||
|
||||
status = query_lock(fsp,
|
||||
&lock_pid,
|
||||
&smblctx,
|
||||
&count,
|
||||
&offset,
|
||||
&lock_type,
|
||||
@@ -4926,7 +4926,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
|
||||
|
||||
SSVAL(pdata, POSIX_LOCK_TYPE_OFFSET, lock_type);
|
||||
SSVAL(pdata, POSIX_LOCK_FLAGS_OFFSET, 0);
|
||||
SIVAL(pdata, POSIX_LOCK_PID_OFFSET, lock_pid);
|
||||
SIVAL(pdata, POSIX_LOCK_PID_OFFSET, (uint32_t)smblctx);
|
||||
#if defined(HAVE_LONGLONG)
|
||||
SIVAL(pdata, POSIX_LOCK_START_OFFSET, (uint32)(offset & 0xFFFFFFFF));
|
||||
SIVAL(pdata, POSIX_LOCK_START_OFFSET + 4, (uint32)((offset >> 32) & 0xFFFFFFFF));
|
||||
@@ -6235,7 +6235,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
|
||||
{
|
||||
uint64_t count;
|
||||
uint64_t offset;
|
||||
uint32 lock_pid;
|
||||
uint64_t smblctx;
|
||||
bool blocking_lock = False;
|
||||
enum brl_type lock_type;
|
||||
|
||||
@@ -6279,7 +6279,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
|
||||
blocking_lock = False;
|
||||
}
|
||||
|
||||
lock_pid = IVAL(pdata, POSIX_LOCK_PID_OFFSET);
|
||||
smblctx = (uint64_t)IVAL(pdata, POSIX_LOCK_PID_OFFSET);
|
||||
#if defined(HAVE_LONGLONG)
|
||||
offset = (((uint64_t) IVAL(pdata,(POSIX_LOCK_START_OFFSET+4))) << 32) |
|
||||
((uint64_t) IVAL(pdata,POSIX_LOCK_START_OFFSET));
|
||||
@@ -6291,33 +6291,33 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
|
||||
#endif /* HAVE_LONGLONG */
|
||||
|
||||
DEBUG(10,("smb_set_posix_lock: file %s, lock_type = %u,"
|
||||
"lock_pid = %u, count = %.0f, offset = %.0f\n",
|
||||
"smblctx = %llu, count = %.0f, offset = %.0f\n",
|
||||
fsp_str_dbg(fsp),
|
||||
(unsigned int)lock_type,
|
||||
(unsigned int)lock_pid,
|
||||
(unsigned long long)smblctx,
|
||||
(double)count,
|
||||
(double)offset ));
|
||||
|
||||
if (lock_type == UNLOCK_LOCK) {
|
||||
status = do_unlock(smbd_messaging_context(),
|
||||
fsp,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
count,
|
||||
offset,
|
||||
POSIX_LOCK);
|
||||
} else {
|
||||
uint32 block_smbpid;
|
||||
uint64_t block_smblctx;
|
||||
|
||||
struct byte_range_lock *br_lck = do_lock(smbd_messaging_context(),
|
||||
fsp,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
count,
|
||||
offset,
|
||||
lock_type,
|
||||
POSIX_LOCK,
|
||||
blocking_lock,
|
||||
&status,
|
||||
&block_smbpid,
|
||||
&block_smblctx,
|
||||
NULL);
|
||||
|
||||
if (br_lck && blocking_lock && ERROR_WAS_LOCK_DENIED(status)) {
|
||||
@@ -6331,12 +6331,12 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
|
||||
fsp,
|
||||
-1, /* infinite timeout. */
|
||||
0,
|
||||
lock_pid,
|
||||
smblctx,
|
||||
lock_type,
|
||||
POSIX_LOCK,
|
||||
offset,
|
||||
count,
|
||||
block_smbpid)) {
|
||||
block_smblctx)) {
|
||||
TALLOC_FREE(br_lck);
|
||||
return status;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user