Jeremy.
this client */
struct lock_context {
- uint32 smbpid;
+ uint64_t smblctx;
uint16 tid;
struct server_id pid;
};
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;
};
struct smbd_lock_element {
- uint32_t smbpid;
+ uint64_t smblctx;
enum brl_type brltype;
uint64_t offset;
uint64_t count;
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,
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,
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,
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,
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,
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);
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) ));
const struct lock_context *ctx2)
{
return (procid_equal(&ctx1->pid, &ctx2->pid) &&
- (ctx1->smbpid == ctx2->smbpid) &&
+ (ctx1->smblctx == ctx2->smblctx) &&
(ctx1->tid == ctx2->tid));
}
/* 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
&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;
/* 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. */
/* 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;
}
&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);
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;
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;
#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;
}
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,
{
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;
****************************************************************************/
bool brl_locktest(struct byte_range_lock *br_lck,
- uint32 smbpid,
+ uint64_t smblctx,
struct server_id pid,
br_off start,
br_off size,
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;
****************************************************************************/
NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
- uint32 *psmbpid,
+ uint64_t *psmblctx,
struct server_id pid,
br_off *pstart,
br_off *psize,
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;
}
if (conflict) {
- *psmbpid = exlock->context.smbpid;
+ *psmblctx = exlock->context.smblctx;
*pstart = exlock->start;
*psize = exlock->size;
*plock_type = exlock->lock_type;
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;
}
}
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,
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;
(lock->fnum == fnum)) {
brl_unlock(msg_ctx,
br_lck,
- lock->context.smbpid,
+ lock->context.smblctx,
pid,
lock->start,
lock->size,
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],
****************************************************************************/
void init_strict_lock_struct(files_struct *fsp,
- uint32 smbpid,
+ uint64_t smblctx,
br_off start,
br_off size,
enum brl_type lock_type,
{
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;
return True;
}
ret = brl_locktest(br_lck,
- plock->context.smbpid,
+ plock->context.smblctx,
plock->context.pid,
plock->start,
plock->size,
return True;
}
ret = brl_locktest(br_lck,
- plock->context.smbpid,
+ plock->context.smblctx,
plock->context.pid,
plock->start,
plock->size,
****************************************************************************/
NTSTATUS query_lock(files_struct *fsp,
- uint32 *psmbpid,
+ uint64_t *psmblctx,
uint64_t *pcount,
uint64_t *poffset,
enum brl_type *plock_type,
}
return brl_lockquery(br_lck,
- psmbpid,
+ psmblctx,
procid_self(),
poffset,
pcount,
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;
*perr = brl_lock(msg_ctx,
br_lck,
- lock_pid,
+ smblctx,
procid_self(),
offset,
- count,
+ count,
lock_type,
lock_flav,
blocking_lock,
- plock_pid,
+ psmblctx,
blr);
DEBUG(10, ("do_lock: returning status=%s\n", nt_errstr(*perr)));
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)
ok = brl_unlock(msg_ctx,
br_lck,
- lock_pid,
+ smblctx,
procid_self(),
offset,
count,
****************************************************************************/
NTSTATUS do_lock_cancel(files_struct *fsp,
- uint32 lock_pid,
+ uint64 smblctx,
uint64_t count,
uint64_t offset,
enum brl_flavour lock_flav,
}
ok = brl_lock_cancel(br_lck,
- lock_pid,
+ smblctx,
procid_self(),
offset,
count,
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);
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);
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);
}
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;
fsp,
lock_timeout,
lock_num,
- lock_pid,
+ smblctx,
lock_type,
lock_flav,
offset,
count,
- blocking_pid);
+ blocking_smblctx);
}
if(req_is_in_chain(req)) {
(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;
/* Add a pending lock record for this. */
status = brl_lock(smbd_messaging_context(),
br_lck,
- lock_pid,
+ smblctx,
procid_self(),
offset,
count,
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;
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;
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);
do_unlock(smbd_messaging_context(),
fsp,
- lock_pid,
+ smblctx,
count,
offset,
WINDOWS_LOCK);
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;
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);
errno = 0;
br_lck = do_lock(smbd_messaging_context(),
fsp,
- lock_pid,
+ smblctx,
count,
- offset,
+ offset,
((locktype & LOCKING_ANDX_SHARED_LOCK) ?
READ_LOCK : WRITE_LOCK),
WINDOWS_LOCK,
True,
&status,
- &blr->blocking_pid,
+ &blr->blocking_smblctx,
blr);
TALLOC_FREE(br_lck);
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);
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,
SMB_ASSERT(blr_cancelled == blr);
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
fsp->fnum ));
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
if (br_lck) {
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
fsp_str_dbg(blr->fsp)));
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
*****************************************************************************/
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,
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) {
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,
/* 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);
br_lck = do_lock(smbd_messaging_context(),
fsp,
- req->smbpid,
+ (uint64_t)req->smbpid,
(uint64_t)numtoread,
(uint64_t)startpos,
WRITE_LOCK,
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);
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);
}
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);
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);
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);
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);
/* 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);
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);
br_lck = do_lock(smbd_messaging_context(),
fsp,
- req->smbpid,
+ (uint64_t)req->smbpid,
count,
offset,
WRITE_LOCK,
status = do_unlock(smbd_messaging_context(),
fsp,
- req->smbpid,
+ (uint64_t)req->smbpid,
count,
offset,
WINDOWS_LOCK);
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));
}
/****************************************************************************
"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) {
status = do_unlock(smbd_messaging_context(),
fsp,
- e->smbpid,
+ e->smblctx,
e->count,
e->offset,
WINDOWS_LOCK);
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));
return the right error. */
blr = blocking_lock_cancel_smb1(fsp,
- e->smbpid,
+ e->smblctx,
e->offset,
e->count,
WINDOWS_LOCK,
}
/* Remove a matching pending lock. */
status = do_lock_cancel(fsp,
- e->smbpid,
+ e->smblctx,
e->count,
e->offset,
WINDOWS_LOCK,
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)) {
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;
do_unlock(smbd_messaging_context(),
fsp,
- e->smbpid,
+ e->smblctx,
e->count,
e->offset,
WINDOWS_LOCK);
/* 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;
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);
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;
}
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 ));
}
}
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);
}
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;
}
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;
/* Add a pending lock record for this. */
status = brl_lock(smbd_messaging_context(),
br_lck,
- lock_pid,
+ smblctx,
procid_self(),
offset,
count,
if (br_lck) {
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
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);
/* Remove the entries from the lock db. */
brl_lock_cancel(br_lck,
- blr->lock_pid,
+ blr->smblctx,
procid_self(),
blr->offset,
blr->count,
{
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. */
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));
#endif /* HAVE_LONGLONG */
status = query_lock(fsp,
- &lock_pid,
+ &smblctx,
&count,
&offset,
&lock_type,
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));
{
uint64_t count;
uint64_t offset;
- uint32 lock_pid;
+ uint64_t smblctx;
bool blocking_lock = False;
enum brl_type lock_type;
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));
#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)) {
fsp,
-1, /* infinite timeout. */
0,
- lock_pid,
+ smblctx,
lock_type,
POSIX_LOCK,
offset,
count,
- block_smbpid)) {
+ block_smblctx)) {
TALLOC_FREE(br_lck);
return status;
}