[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Fri Dec 16 01:11:03 MST 2011


The branch, master has been updated
       via  7000bb6 s3: Add some const to find_oplock_types
       via  2349c02 s3: Make open_file_ntcreate a bit easier to read
       via  ce30a7a s3: Make open_file_ntcreate a bit easier to read
       via  98f7ba5 s3: Make open_file_ntcreate a bit easier to read
       via  bcd3db6 Add support for TCP_DEFER_ACCEPT
       via  432ea5f s3: Slightly simplify delay_for_exclusive_oplocks
       via  b3d8eca s3: Slightly simplify delay_for_batch_oplocks
      from  c5cbe48 Third part of fix for bug #8663 - deleting a symlink fails if the symlink target is outside of the share.

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


- Log -----------------------------------------------------------------
commit 7000bb69332f12d35c41cb08792d29c08736937b
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 10:12:42 2011 +0100

    s3: Add some const to find_oplock_types
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Fri Dec 16 09:10:07 CET 2011 on sn-devel-104

commit 2349c027c1125114363343b71624bf8aa96711b8
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 16:30:08 2011 +0100

    s3: Make open_file_ntcreate a bit easier to read
    
    Move the declaration of "id" closer to its use

commit ce30a7ae7be70eb4cfac5454d453c32c71e4a5ed
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 16:30:08 2011 +0100

    s3: Make open_file_ntcreate a bit easier to read
    
    Move the calculation of "new_file_created" closer to its use

commit 98f7ba52e341db4cd76e63662f90a68cc3624f39
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 16:30:08 2011 +0100

    s3: Make open_file_ntcreate a bit easier to read
    
    Remove a negation where it's not necessary

commit bcd3db6264fbe4d2e71c0844a46b885e3c542e2a
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 16:12:37 2011 +0100

    Add support for TCP_DEFER_ACCEPT
    
    "man tcp" on Linux says:
    
    TCP_DEFER_ACCEPT
    
    Allows a listener to be awakened only when data arrives on the  socket.  Takes
    an integer value (seconds), this can bound the maximum number of attempts TCP
    will make to complete the connection. This option should not be used in code
    intended to be portable.
    
    This might reduce the 139/445 forks a bit on high-load servers

commit 432ea5f5c627b374948d0881d5da2aa9ba700763
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 14:35:07 2011 +0100

    s3: Slightly simplify delay_for_exclusive_oplocks

commit b3d8ecaf52851493afa7ff07d8cfd10cd32d99e6
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Dec 15 14:33:06 2011 +0100

    s3: Slightly simplify delay_for_batch_oplocks

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

Summary of changes:
 lib/util/util_net.c |    3 ++
 source3/smbd/open.c |   59 ++++++++++++++++++++++++++++----------------------
 2 files changed, 36 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util_net.c b/lib/util/util_net.c
index 1f6ecdd..637c52b 100644
--- a/lib/util/util_net.c
+++ b/lib/util/util_net.c
@@ -812,6 +812,9 @@ static const smb_socket_option socket_options[] = {
 #ifdef TCP_KEEPALIVE_ABORT_THRESHOLD
   {"TCP_KEEPALIVE_ABORT_THRESHOLD", IPPROTO_TCP, TCP_KEEPALIVE_ABORT_THRESHOLD, 0, OPT_INT},
 #endif
+#ifdef TCP_DEFER_ACCEPT
+  {"TCP_DEFER_ACCEPT", IPPROTO_TCP, TCP_DEFER_ACCEPT, 0, OPT_INT},
+#endif
   {NULL,0,0,0,0}};
 
 /****************************************************************************
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 9174388..8b7b47b 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -1084,7 +1084,7 @@ static NTSTATUS send_break_message(files_struct *fsp,
 
 static void find_oplock_types(files_struct *fsp,
 				int oplock_request,
-				struct share_mode_lock *lck,
+				const struct share_mode_lock *lck,
 				struct share_mode_entry **pp_batch,
 				struct share_mode_entry **pp_ex_or_batch,
 				bool *got_level2,
@@ -1158,13 +1158,13 @@ static bool delay_for_batch_oplocks(files_struct *fsp,
 	if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
 		return false;
 	}
-
-	if (batch_entry != NULL) {
-		/* Found a batch oplock */
-		send_break_message(fsp, batch_entry, mid, oplock_request);
-		return true;
+	if (batch_entry == NULL) {
+		return false;
 	}
-	return false;
+
+	/* Found a batch oplock */
+	send_break_message(fsp, batch_entry, mid, oplock_request);
+	return true;
 }
 
 static bool delay_for_exclusive_oplocks(files_struct *fsp,
@@ -1172,20 +1172,26 @@ static bool delay_for_exclusive_oplocks(files_struct *fsp,
 					int oplock_request,
 					struct share_mode_entry *ex_entry)
 {
+	bool delay_it;
+
 	if ((oplock_request & INTERNAL_OPEN_ONLY) || is_stat_open(fsp->access_mask)) {
 		return false;
 	}
+	if (ex_entry == NULL) {
+		return false;
+	}
 
-	if (ex_entry != NULL) {
-		/* Found an exclusive or batch oplock */
-		bool delay_it = is_delete_request(fsp) ?
-				BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
-		if (delay_it) {
-			send_break_message(fsp, ex_entry, mid, oplock_request);
-			return true;
-		}
+	/* Found an exclusive or batch oplock */
+
+	delay_it = is_delete_request(fsp) ?
+		BATCH_OPLOCK_TYPE(ex_entry->op_type) : true;
+
+	if (!delay_it) {
+		return false;
 	}
-	return false;
+
+	send_break_message(fsp, ex_entry, mid, oplock_request);
+	return true;
 }
 
 static void grant_fsp_oplock_type(files_struct *fsp,
@@ -1633,7 +1639,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 	bool posix_open = False;
 	bool new_file_created = False;
 	bool clear_ads = false;
-	struct file_id id;
 	NTSTATUS fsp_open = NT_STATUS_ACCESS_DENIED;
 	mode_t new_unx_mode = (mode_t)0;
 	mode_t unx_mode = (mode_t)0;
@@ -1645,8 +1650,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 	NTSTATUS status;
 	char *parent_dir;
 
-	ZERO_STRUCT(id);
-
 	if (conn->printer) {
 		/*
 		 * Printers are handled completely differently.
@@ -1952,6 +1955,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		struct share_mode_entry *exclusive_entry = NULL;
 		bool got_level2_oplock = false;
 		bool got_a_none_oplock = false;
+		struct file_id id;
 
 		struct timespec old_write_time = smb_fname->st.st_ex_mtime;
 		id = vfs_file_id_from_sbuf(conn, &smb_fname->st);
@@ -2185,6 +2189,7 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		bool got_level2_oplock = false;
 		bool got_a_none_oplock = false;
 		struct timespec old_write_time = smb_fname->st.st_ex_mtime;
+		struct file_id id;
 		/*
 		 * Deal with the race condition where two smbd's detect the
 		 * file doesn't exist and do the create at the same time. One
@@ -2370,10 +2375,10 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 			fsp->oplock_type = NO_OPLOCK;
 		}
 
-		if (!(flags2 & O_TRUNC)) {
-			info = FILE_WAS_OPENED;
-		} else {
+		if (flags2 & O_TRUNC) {
 			info = FILE_WAS_OVERWRITTEN;
+		} else {
+			info = FILE_WAS_OPENED;
 		}
 	} else {
 		info = FILE_WAS_CREATED;
@@ -2396,10 +2401,6 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		fsp->oplock_type = NO_OPLOCK;
 	}
 
-	if (info == FILE_WAS_OVERWRITTEN || info == FILE_WAS_CREATED || info == FILE_WAS_SUPERSEDED) {
-		new_file_created = True;
-	}
-
 	set_share_mode(lck, fsp, get_current_uid(conn),
 			req ? req->mid : 0,
 		       fsp->oplock_type);
@@ -2421,6 +2422,12 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 		fsp->initial_delete_on_close = True;
 	}
 
+	if (info == FILE_WAS_OVERWRITTEN
+	    || info == FILE_WAS_CREATED
+	    || info == FILE_WAS_SUPERSEDED) {
+		new_file_created = True;
+	}
+
 	if (new_file_created) {
 		/* Files should be initially set as archive */
 		if (lp_map_archive(SNUM(conn)) ||


-- 
Samba Shared Repository


More information about the samba-cvs mailing list