summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-05-07 06:20:50 -0700
committerJeremy Allison <jra@samba.org>2010-05-07 06:20:50 -0700
commitadf4833792f36653bc8a854aeff47598a046dad6 (patch)
tree5b7855392d7204218df45563e09486957a3f6d9e /source3/smbd
parent6fd4861d9def34c4dccce214c78bfbcc0fa291fd (diff)
downloadsamba-adf4833792f36653bc8a854aeff47598a046dad6.tar.gz
samba-adf4833792f36653bc8a854aeff47598a046dad6.tar.bz2
samba-adf4833792f36653bc8a854aeff47598a046dad6.zip
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.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/aio.c4
-rw-r--r--source3/smbd/blocking.c54
-rw-r--r--source3/smbd/globals.h4
-rw-r--r--source3/smbd/reply.c60
-rw-r--r--source3/smbd/smb2_lock.c28
-rw-r--r--source3/smbd/trans2.c28
6 files changed, 89 insertions, 89 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index b775977a72..0bc83dddd3 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -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);
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index 942237b812..da14ce89c9 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -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,15 +449,15 @@ static bool process_lockingX(struct blocking_lock_record *blr)
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);
@@ -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) {
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 6543ee6f24..b6aa704f18 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -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,
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 571b8a8ab0..f02fc9a152 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -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);
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 9c8964abb8..8ea36be8ed 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -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,
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 9c2e3296e5..25ca3fd3ae 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -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;
}