The branch, master has been updated
       via  5a88e43... s3: Make sure our CLEAR_IF_FIRST optimization works for 
serverid.tdb
       via  ed18945... s3: Make sure our CLEAR_IF_FIRST optimization works for 
the notify tdbs
       via  4cdbe07... s3: Make sure our CLEAR_IF_FIRST optimization works for 
messaging.tdb
       via  f20bdd3... s3: Fix some nonempty blank lines
      from  9a5d50b... s3-selftest: enable RAP-RPC test against s3.

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


- Log -----------------------------------------------------------------
commit 5a88e43c693f9e0c5dd93e4fd238364262643b5a
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 25 16:02:54 2010 +0100

    s3: Make sure our CLEAR_IF_FIRST optimization works for serverid.tdb
    
    In the child, we fully re-open serverid.tdb, which leads to one fcntl lock 
for
    CLEAR_IF_FIRST detection per smbd. This opens the tdb in the parent and 
holds
    it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.

commit ed189459b9d7776700ffd353f81b283232940199
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 25 16:01:54 2010 +0100

    s3: Make sure our CLEAR_IF_FIRST optimization works for the notify tdbs
    
    The notify tdb files are opened at tconX time, which leads to one fcntl lock
    for CLEAR_IF_FIRST detection per smbd. This opens the tdbs in the parent and
    holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.

commit 4cdbe07b2563b56c2d8b9a5733eedf25245ba86b
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 25 15:59:41 2010 +0100

    s3: Make sure our CLEAR_IF_FIRST optimization works for messaging.tdb
    
    In the child, we fully re-open messaging.tdb, which leads to one fcntl lock 
for
    CLEAR_IF_FIRST detection per smbd. This opens the tdb in the parent and 
holds
    it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.

commit f20bdd32ddabf79800c876fa94b65b928bea3c30
Author: Volker Lendecke <[email protected]>
Date:   Thu Mar 25 15:43:47 2010 +0100

    s3: Fix some nonempty blank lines

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

Summary of changes:
 source3/include/messages.h     |    2 ++
 source3/include/proto.h        |    1 +
 source3/include/serverid.h     |    5 +++++
 source3/lib/messages_local.c   |   28 ++++++++++++++++++++++------
 source3/lib/serverid.c         |   16 ++++++++++++++++
 source3/smbd/notify_internal.c |   27 +++++++++++++++++++++++++++
 source3/smbd/server.c          |   12 ++++++++++++
 7 files changed, 85 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/messages.h b/source3/include/messages.h
index 6063d35..865ffd4 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -111,6 +111,8 @@ NTSTATUS messaging_tdb_init(struct messaging_context 
*msg_ctx,
                            TALLOC_CTX *mem_ctx,
                            struct messaging_backend **presult);
 
+bool messaging_tdb_parent_init(void);
+
 NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
                              TALLOC_CTX *mem_ctx,
                              struct messaging_backend **presult);
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e8f9985..dca58cc 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6545,6 +6545,7 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, 
struct server_id server,
                                   struct messaging_context *messaging_ctx,
                                   struct event_context *ev,
                                   connection_struct *conn);
+bool notify_internal_parent_init(void);
 NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0,
                    void (*callback)(void *, const struct notify_event *), 
                    void *private_data);
diff --git a/source3/include/serverid.h b/source3/include/serverid.h
index 9ef778c..e60fc47 100644
--- a/source3/include/serverid.h
+++ b/source3/include/serverid.h
@@ -63,4 +63,9 @@ bool serverid_traverse_read(int (*fn)(const struct server_id 
*id,
                                      uint32_t msg_flags,
                                      void *private_data),
                            void *private_data);
+/*
+ * Ensure CLEAR_IF_FIRST works fine, to be called from the parent smbd
+ */
+bool serverid_parent_init(void);
+
 #endif
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index 0da0546..b171282 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -2,17 +2,17 @@
    Unix SMB/CIFS implementation.
    Samba internal messaging functions
    Copyright (C) 2007 by Volker Lendecke
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -21,7 +21,7 @@
   @defgroup messages Internal messaging framework
   @{
   @file messages.c
-  
+
   @brief  Module for internal messaging between Samba daemons. 
 
    The idea is that if a part of Samba wants to do communication with
@@ -133,6 +133,22 @@ NTSTATUS messaging_tdb_init(struct messaging_context 
*msg_ctx,
        return NT_STATUS_OK;
 }
 
+bool messaging_tdb_parent_init(void)
+{
+       struct tdb_wrap *db;
+
+       db = tdb_wrap_open(talloc_autofree_context(),
+                          lock_path("messages.tdb"), 0,
+                          TDB_CLEAR_IF_FIRST|TDB_DEFAULT|TDB_VOLATILE,
+                          O_RDWR|O_CREAT,0600);
+       if (db == NULL) {
+               DEBUG(1, ("could not open messaging.tdb: %s\n",
+                         strerror(errno)));
+               return false;
+       }
+       return true;
+}
+
 /*******************************************************************
  Form a static tdb key from a pid.
 ******************************************************************/
@@ -145,7 +161,7 @@ static TDB_DATA message_key_pid(TALLOC_CTX *mem_ctx, struct 
server_id pid)
        key = talloc_asprintf(talloc_tos(), "PID/%s", procid_str_static(&pid));
 
        SMB_ASSERT(key != NULL);
-       
+
        kbuf.dptr = (uint8 *)key;
        kbuf.dsize = strlen(key)+1;
        return kbuf;
@@ -371,7 +387,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context 
*msg_ctx,
        if (!NT_STATUS_IS_OK(status)) {
                goto done;
        }
-       
+
        status = message_notify(pid);
 
        if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) {
diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c
index 9842ead..5401eed 100644
--- a/source3/lib/serverid.c
+++ b/source3/lib/serverid.c
@@ -27,6 +27,22 @@ struct serverid_key {
 #endif
 };
 
+bool serverid_parent_init(void)
+{
+       struct tdb_wrap *db;
+
+       db = tdb_wrap_open(talloc_autofree_context(),
+                          lock_path("serverid.tdb"),
+                          0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT,
+                          0644);
+       if (db == NULL) {
+               DEBUG(1, ("could not open serverid.tdb: %s\n",
+                         strerror(errno)));
+               return false;
+       }
+       return true;
+}
+
 struct serverid_data {
        uint64_t unique_id;
        uint32_t msg_flags;
diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c
index 0467e67..0e38da6 100644
--- a/source3/smbd/notify_internal.c
+++ b/source3/smbd/notify_internal.c
@@ -128,6 +128,33 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, 
struct server_id server,
        return notify;
 }
 
+bool notify_internal_parent_init(void)
+{
+       struct tdb_wrap *db1, *db2;
+
+       if (lp_clustering()) {
+               return true;
+       }
+
+       db1 = tdb_wrap_open(talloc_autofree_context(), lock_path("notify.tdb"),
+                           0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST,
+                          O_RDWR|O_CREAT, 0644);
+       if (db1 == NULL) {
+               DEBUG(1, ("could not open notify.tdb: %s\n", strerror(errno)));
+               return false;
+       }
+       db2 = tdb_wrap_open(talloc_autofree_context(),
+                           lock_path("notify_onelevel.tdb"),
+                           0, TDB_CLEAR_IF_FIRST, O_RDWR|O_CREAT, 0644);
+       if (db2 == NULL) {
+               DEBUG(1, ("could not open notify_onelevel.tdb: %s\n",
+                         strerror(errno)));
+               TALLOC_FREE(db1);
+               return false;
+       }
+       return true;
+}
+
 /*
   lock and fetch the record
 */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 81d75b1..e5cfc27 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -1296,6 +1296,18 @@ extern void build_options(bool screen);
        if (!locking_init())
                exit(1);
 
+       if (!messaging_tdb_parent_init()) {
+               exit(1);
+       }
+
+       if (!notify_internal_parent_init()) {
+               exit(1);
+       }
+
+       if (!serverid_parent_init()) {
+               exit(1);
+       }
+
        namecache_enable();
 
        if (!W_ERROR_IS_OK(registry_init_full()))


-- 
Samba Shared Repository

Reply via email to