summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-04-29 17:08:12 -0700
committerJeremy Allison <jra@samba.org>2010-04-29 17:08:12 -0700
commite90444319c37c413ffc4e3a02531309dfa3ff565 (patch)
treec58c01e8ab952713793780a37399913c6eb65187 /source3/smbd
parentebf6340bb568f279fc8b94856e01de473bd08575 (diff)
downloadsamba-e90444319c37c413ffc4e3a02531309dfa3ff565.tar.gz
samba-e90444319c37c413ffc4e3a02531309dfa3ff565.tar.bz2
samba-e90444319c37c413ffc4e3a02531309dfa3ff565.zip
Carefully label SMB1-specific locking calls.
Jeremy.
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/blocking.c19
-rw-r--r--source3/smbd/globals.h2
-rw-r--r--source3/smbd/nttrans.c2
-rw-r--r--source3/smbd/reply.c2
-rw-r--r--source3/smbd/smb2_lock.c5
-rw-r--r--source3/smbd/trans2.c2
6 files changed, 24 insertions, 8 deletions
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index f399e6b3c7..c10899f5e6 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -561,6 +561,7 @@ static bool blocking_lock_record_process(struct blocking_lock_record *blr)
/****************************************************************************
Cancel entries by fnum from the blocking lock pending queue.
+ Called when a file is closed.
*****************************************************************************/
void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck)
@@ -568,6 +569,11 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lo
struct smbd_server_connection *sconn = smbd_server_conn;
struct blocking_lock_record *blr, *blr_cancelled, *next = NULL;
+ if (sconn->allow_smb2) {
+ cancel_pending_lock_requests_by_fid_smb2(fsp, br_lck);
+ return;
+ }
+
for(blr = sconn->smb1.locks.blocking_lock_queue; blr; blr = next) {
unsigned char locktype = 0;
@@ -584,7 +590,7 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lo
"request type %d for file %s fnum = %d\n",
blr->req->cmd, fsp_str_dbg(fsp), fsp->fnum));
- blr_cancelled = blocking_lock_cancel(fsp,
+ blr_cancelled = blocking_lock_cancel_smb1(fsp,
blr->lock_pid,
blr->offset,
blr->count,
@@ -610,9 +616,10 @@ void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lo
/****************************************************************************
Delete entries by mid from the blocking lock pending queue. Always send reply.
+ Only called from the SMB1 cancel code.
*****************************************************************************/
-void remove_pending_lock_requests_by_mid(uint64_t mid)
+void remove_pending_lock_requests_by_mid_smb1(uint64_t mid)
{
struct smbd_server_connection *sconn = smbd_server_conn;
struct blocking_lock_record *blr, *next = NULL;
@@ -631,7 +638,7 @@ void remove_pending_lock_requests_by_mid(uint64_t mid)
br_lck = brl_get_locks(talloc_tos(), fsp);
if (br_lck) {
- DEBUG(10, ("remove_pending_lock_requests_by_mid - "
+ DEBUG(10, ("remove_pending_lock_requests_by_mid_smb1 - "
"removing request type %d for file %s fnum "
"= %d\n", blr->req->cmd, fsp_str_dbg(fsp),
fsp->fnum ));
@@ -654,9 +661,10 @@ void remove_pending_lock_requests_by_mid(uint64_t mid)
/****************************************************************************
Is this mid a blocking lock request on the queue ?
+ Currently only called from the SMB1 unix extensions POSIX lock code.
*****************************************************************************/
-bool blocking_lock_was_deferred(uint64_t mid)
+bool blocking_lock_was_deferred_smb1(uint64_t mid)
{
struct smbd_server_connection *sconn = smbd_server_conn;
struct blocking_lock_record *blr, *next = NULL;
@@ -823,9 +831,10 @@ static void process_blocking_lock_cancel_message(struct messaging_context *ctx,
/****************************************************************************
Send ourselves a blocking lock cancelled message. Handled asynchronously above.
Returns the blocking_lock_record that is being cancelled.
+ Only called from the SMB1 code.
*****************************************************************************/
-struct blocking_lock_record *blocking_lock_cancel(files_struct *fsp,
+struct blocking_lock_record *blocking_lock_cancel_smb1(files_struct *fsp,
uint32 lock_pid,
uint64_t offset,
uint64_t count,
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 614d8fcdb5..be140ba445 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -324,6 +324,8 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
uint64_t offset,
uint64_t count,
uint32_t blocking_pid);
+void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
+ struct byte_range_lock *br_lck);
/* From smbd/smb2_create.c */
int map_smb2_oplock_levels_to_samba(uint8_t in_oplock_level);
uint8_t map_samba_oplock_levels_to_smb2(int oplock_type);
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index b594b7e4bc..496c38db84 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1278,7 +1278,7 @@ void reply_ntcancel(struct smb_request *req)
START_PROFILE(SMBntcancel);
srv_cancel_sign_response(smbd_server_conn);
remove_pending_change_notify_requests_by_mid(req->mid);
- remove_pending_lock_requests_by_mid(req->mid);
+ remove_pending_lock_requests_by_mid_smb1(req->mid);
DEBUG(3,("reply_ntcancel: cancel called on mid = %llu.\n",
(unsigned long long)req->mid));
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 56c067f4dc..6469ad8306 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -7174,7 +7174,7 @@ NTSTATUS smbd_do_locking(struct smb_request *req,
remove the blocking lock record and
return the right error. */
- blr = blocking_lock_cancel(fsp,
+ blr = blocking_lock_cancel_smb1(fsp,
e->smbpid,
e->offset,
e->count,
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 597034c1da..d7a6cb1376 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -401,3 +401,8 @@ bool push_blocking_lock_request_smb2( struct byte_range_lock *br_lck,
{
return false;
}
+
+void cancel_pending_lock_requests_by_fid_smb2(files_struct *fsp,
+ struct byte_range_lock *br_lck)
+{
+}
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 102b41f91a..811a647ab3 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -7842,7 +7842,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
/* We have re-scheduled this call. */
return;
}
- if (blocking_lock_was_deferred(req->mid)) {
+ if (blocking_lock_was_deferred_smb1(req->mid)) {
/* We have re-scheduled this call. */
return;
}