The branch, master has been updated
       via  35c0f16 s3:smbd: do a clean shutdown during release_ip() after 
CTDB_SRVID_RELEASE_IP
       via  d73b793 s3:smbd: use print_sockaddr() instead of 
client_socket_addr()
       via  13de233 s3:smbd: move smbd_register_ips() next to release_ip()
       via  ec69eb4 s3:dbwrap_ctdb: initialize db_record->db
      from  cddcaf7 ldb: Add parameter to avoid NULL format string flagged by 
-Werror=format

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


- Log -----------------------------------------------------------------
commit 35c0f164bcdbb52e38aa9d53b90d368659963764
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Jul 29 23:23:09 2012 +0200

    s3:smbd: do a clean shutdown during release_ip() after CTDB_SRVID_RELEASE_IP
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <[email protected]>
    Autobuild-Date(master): Tue Jul 31 11:33:27 CEST 2012 on sn-devel-104

commit d73b7938bba32725b37f9bfa7ce3e23fbea50ce4
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Jul 29 23:27:56 2012 +0200

    s3:smbd: use print_sockaddr() instead of client_socket_addr()
    
    We already have a server address in sockaddr_storage format.
    
    Also the name "client_socket" was very miss leading,
    as it returns the local address of the socket.
    
    metze

commit 13de233fc6a562387791281b3b0cc1bcbe56b9ef
Author: Stefan Metzmacher <[email protected]>
Date:   Sun Jul 29 23:25:12 2012 +0200

    s3:smbd: move smbd_register_ips() next to release_ip()
    
    metze

commit ec69eb41bf1e32bec1d2d6e40bcfbd635ca505d2
Author: Stefan Metzmacher <[email protected]>
Date:   Tue Jul 31 09:30:29 2012 +0200

    s3:dbwrap_ctdb: initialize db_record->db
    
    metze

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

Summary of changes:
 source3/lib/dbwrap/dbwrap_ctdb.c |    1 +
 source3/smbd/process.c           |   90 +++++++++++++++++++++++---------------
 2 files changed, 55 insertions(+), 36 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 5605b47..0a57997 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -1057,6 +1057,7 @@ static struct db_record *fetch_locked_internal(struct 
db_ctdb_ctx *ctx,
                return NULL;
        }
 
+       result->db = ctx->db;
        result->private_data = (void *)crec;
        crec->ctdb_ctx = ctx;
 
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index adb773d..dd26a27 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -2462,12 +2462,21 @@ static void smbd_server_echo_handler(struct 
event_context *ev,
 }
 
 #ifdef CLUSTER_SUPPORT
+
+struct smbd_release_ip_state {
+       struct smbd_server_connection *sconn;
+       char addr[INET6_ADDRSTRLEN];
+};
+
 /****************************************************************************
 received when we should release a specific IP
 ****************************************************************************/
 static void release_ip(const char *ip, void *priv)
 {
-       const char *addr = (const char *)priv;
+       struct smbd_release_ip_state *state =
+               talloc_get_type_abort(priv,
+               struct smbd_release_ip_state);
+       const char *addr = state->addr;
        const char *p = addr;
 
        if (strncmp("::ffff:", addr, 7) == 0) {
@@ -2478,19 +2487,55 @@ static void release_ip(const char *ip, void *priv)
                   "our address is %s\n", ip, p));
 
        if ((strcmp(p, ip) == 0) || ((p != addr) && strcmp(addr, ip) == 0)) {
-               /* we can't afford to do a clean exit - that involves
-                  database writes, which would potentially mean we
-                  are still running after the failover has finished -
-                  we have to get rid of this process ID straight
-                  away */
                DEBUG(0,("Got release IP message for our IP %s - exiting 
immediately\n",
                        ip));
-               /* note we must exit with non-zero status so the unclean 
handler gets
-                  called in the parent, so that the brl database is tickled */
-               _exit(1);
+               /*
+                * With SMB2 we should do a clean disconnect,
+                * the previous_session_id in the session setup
+                * will cleanup the old session, tcons and opens.
+                *
+                * A clean disconnect is needed in order to support
+                * durable handles.
+                *
+                * Note: typically this is never triggered
+                *       as we got a TCP RST (triggered by ctdb event scripts)
+                *       before we get CTDB_SRVID_RELEASE_IP.
+                *
+                * We used to call _exit(1) here, but as this was mostly never
+                * triggered and has implication on our process model,
+                * we can just use smbd_server_connection_terminate()
+                * (also for SMB1).
+                */
+               smbd_server_connection_terminate(state->sconn,
+                                                "CTDB_SRVID_RELEASE_IP");
+               return;
        }
 }
 
+static NTSTATUS smbd_register_ips(struct smbd_server_connection *sconn,
+                                 struct sockaddr_storage *srv,
+                                 struct sockaddr_storage *clnt)
+{
+       struct smbd_release_ip_state *state;
+       struct ctdbd_connection *cconn;
+
+       cconn = messaging_ctdbd_connection();
+       if (cconn == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       state = talloc_zero(sconn, struct smbd_release_ip_state);
+       if (state == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       state->sconn = sconn;
+       if (print_sockaddr(state->addr, sizeof(state->addr), srv) == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       return ctdbd_register_ips(cconn, srv, clnt, release_ip, state);
+}
+
 static int client_get_tcp_info(int sock, struct sockaddr_storage *server,
                               struct sockaddr_storage *client)
 {
@@ -3067,33 +3112,6 @@ fail:
        return false;
 }
 
-#if CLUSTER_SUPPORT
-
-static NTSTATUS smbd_register_ips(struct smbd_server_connection *sconn,
-                                 struct sockaddr_storage *srv,
-                                 struct sockaddr_storage *clnt)
-{
-       struct ctdbd_connection *cconn;
-       char tmp_addr[INET6_ADDRSTRLEN];
-       char *addr;
-
-       cconn = messaging_ctdbd_connection();
-       if (cconn == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       if (client_socket_addr(sconn->sock, tmp_addr, sizeof(tmp_addr)) == 
NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       addr = talloc_strdup(cconn, tmp_addr);
-       if (addr == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       return ctdbd_register_ips(cconn, srv, clnt, release_ip, addr);
-}
-
-#endif
-
 static bool uid_in_use(const struct user_struct *user, uid_t uid)
 {
        while (user) {


-- 
Samba Shared Repository

Reply via email to