[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Apr 29 18:09:04 MDT 2010


The branch, master has been updated
       via  e904443... Carefully label SMB1-specific locking calls.
      from  ebf6340... Move the global blocking lock records into the smb1 state.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e90444319c37c413ffc4e3a02531309dfa3ff565
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Apr 29 17:08:12 2010 -0700

    Carefully label SMB1-specific locking calls.
    
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h  |    6 +++---
 source3/smbd/blocking.c  |   19 ++++++++++++++-----
 source3/smbd/globals.h   |    2 ++
 source3/smbd/nttrans.c   |    2 +-
 source3/smbd/reply.c     |    2 +-
 source3/smbd/smb2_lock.c |    5 +++++
 source3/smbd/trans2.c    |    2 +-
 7 files changed, 27 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 1eaa008..929d1ec 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6114,9 +6114,9 @@ bool push_blocking_lock_request( struct byte_range_lock *br_lck,
 		uint64_t count,
 		uint32 blocking_pid);
 void cancel_pending_lock_requests_by_fid(files_struct *fsp, struct byte_range_lock *br_lck);
-void remove_pending_lock_requests_by_mid(uint64_t mid);
-bool blocking_lock_was_deferred(uint64_t mid);
-struct blocking_lock_record *blocking_lock_cancel(files_struct *fsp,
+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 offset,
 			uint64_t count,
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index f399e6b..c10899f 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 614d8fc..be140ba 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 b594b7e..496c38d 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 56c067f..6469ad8 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 597034c..d7a6cb1 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 102b41f..811a647 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;
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list