[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Oct 17 17:18:02 MDT 2013


The branch, master has been updated
       via  0196619 s3:nmbd: do a very early cluster probe when starting nmbd.
       via  5eae612 s3:winbindd: use cluster_probe_ok()
       via  0c21676 s3:smbd: use new function cluster_probe_ok()
       via  972c831 s3: add cluster_probe_ok() in a new module util_cluster.
       via  fbee579 smbd/winbindd: Do an early check if ctdbd is functional
       via  20d3f30 ctdbd_conn: Remove one call to cluster_fatal
       via  7dff7db ctdbd_conn: Remove one call to cluster_fatal
       via  d730a61 ctdbd_conn: Lift the cluster_fatal call in get_cluster_vnn
      from  2474455 s3:libsmb: call smbXcli_tcon_set_fs_attributes() directly

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


- Log -----------------------------------------------------------------
commit 01966190ac438180e1d1129beaa02d30f58420e9
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 17 15:19:41 2013 +0200

    s3:nmbd: do a very early cluster probe when starting nmbd.
    
    Just as for smbd and winbindd
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri Oct 18 01:17:14 CEST 2013 on sn-devel-104

commit 5eae612c724339b225de8be9057dab4043a625a5
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 17 15:16:19 2013 +0200

    s3:winbindd: use cluster_probe_ok()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 0c21676bed38eced1130130f82d7979e8b7bfd08
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 17 15:15:51 2013 +0200

    s3:smbd: use new function cluster_probe_ok()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit 972c8318129f0397b66a62f7f9c355a5df04d7b4
Author: Michael Adam <obnox at samba.org>
Date:   Thu Oct 17 15:10:11 2013 +0200

    s3: add cluster_probe_ok() in a new module util_cluster.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit fbee5795ab69a35c5440eb5684e4ca807b08b1e3
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 11:15:09 2013 +0100

    smbd/winbindd: Do an early check if ctdbd is functional
    
    This will avoid panic calls when smbd and winbind is started in cluster
    mode before ctdb is functional. It still logs something sane at debug
    level 0, but it does not panic and core anymore.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 20d3f308e294c0ec616fa07570d9ba9254163d8f
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 11:02:52 2013 +0100

    ctdbd_conn: Remove one call to cluster_fatal
    
    This is during startup of a ctdb connection, thus it is not as important
    as in other cases to immediately exit to free up resources
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 7dff7db566cf3052a50d110f059c3d57ee5d2c40
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 11:02:52 2013 +0100

    ctdbd_conn: Remove one call to cluster_fatal
    
    This is during startup of a ctdb connection, thus it is not as important
    as in other cases to immediately exit to free up resources
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit d730a61c1e9f426f4fe9c3c34732c2245b77f0e4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 31 10:54:48 2013 +0100

    ctdbd_conn: Lift the cluster_fatal call in get_cluster_vnn
    
    We have to report a proper error when ctdbd is not around
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

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

Summary of changes:
 source3/include/ctdbd_conn.h                   |    1 +
 source3/lib/ctdbd_conn.c                       |   30 ++++++++++++++++++++++-
 source3/lib/{version_test.c => util_cluster.c} |   23 ++++++++++++++----
 source3/lib/{version_test.c => util_cluster.h} |   17 +++++++------
 source3/nmbd/nmbd.c                            |    5 ++++
 source3/smbd/server.c                          |    5 ++++
 source3/winbindd/winbindd.c                    |    5 ++++
 source3/wscript_build                          |    1 +
 8 files changed, 72 insertions(+), 15 deletions(-)
 copy source3/lib/{version_test.c => util_cluster.c} (63%)
 copy source3/lib/{version_test.c => util_cluster.h} (75%)


Changeset truncated at 500 lines:

diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h
index 64cb1d5..ce5c8ba 100644
--- a/source3/include/ctdbd_conn.h
+++ b/source3/include/ctdbd_conn.h
@@ -89,5 +89,6 @@ NTSTATUS ctdbd_control_local(struct ctdbd_connection *conn, uint32_t opcode,
 NTSTATUS ctdb_watch_us(struct ctdbd_connection *conn);
 NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn);
 NTSTATUS register_with_ctdbd(struct ctdbd_connection *conn, uint64_t srvid);
+NTSTATUS ctdbd_probe(void);
 
 #endif /* _CTDBD_CONN_H */
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index f960541..6ab4bbe 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -128,7 +128,8 @@ static NTSTATUS get_cluster_vnn(struct ctdbd_connection *conn, uint32_t *vnn)
 			       CTDB_CURRENT_NODE, CTDB_CONTROL_GET_PNN, 0, 0,
 			       tdb_null, NULL, NULL, &cstatus);
 	if (!NT_STATUS_IS_OK(status)) {
-		cluster_fatal("ctdbd_control failed\n");
+		DEBUG(1, ("ctdbd_control failed: %s\n", nt_errstr(status)));
+		return status;
 	}
 	*vnn = (uint32_t)cstatus;
 	return status;
@@ -151,7 +152,8 @@ static bool ctdbd_working(struct ctdbd_connection *conn, uint32_t vnn)
 			       CTDB_CONTROL_GET_NODEMAP, 0, 0,
 			       tdb_null, talloc_tos(), &outdata, &cstatus);
 	if (!NT_STATUS_IS_OK(status)) {
-		cluster_fatal("ctdbd_control failed\n");
+		DEBUG(1, ("ctdbd_control failed: %s\n", nt_errstr(status)));
+		return false;
 	}
 	if ((cstatus != 0) || (outdata.dptr == NULL)) {
 		DEBUG(2, ("Received invalid ctdb data\n"));
@@ -1820,8 +1822,32 @@ NTSTATUS ctdb_unwatch(struct ctdbd_connection *conn)
 	return status;
 }
 
+NTSTATUS ctdbd_probe(void)
+{
+	/*
+	 * Do a very early check if ctdbd is around to avoid an abort and core
+	 * later
+	 */
+	struct ctdbd_connection *conn = NULL;
+	NTSTATUS status;
+
+	status = ctdbd_messaging_connection(talloc_tos(), &conn);
+
+	/*
+	 * We only care if we can connect.
+	 */
+	TALLOC_FREE(conn);
+
+	return status;
+}
+
 #else
 
+NTSTATUS ctdbd_probe(void)
+{
+	return NT_STATUS_OK;
+}
+
 NTSTATUS ctdbd_messaging_send_blob(struct ctdbd_connection *conn,
 				   uint32_t dst_vnn, uint64_t dst_srvid,
 				   const uint8_t *buf, size_t buflen)
diff --git a/source3/lib/version_test.c b/source3/lib/util_cluster.c
similarity index 63%
copy from source3/lib/version_test.c
copy to source3/lib/util_cluster.c
index 880cfeb..ef79c8b 100644
--- a/source3/lib/version_test.c
+++ b/source3/lib/util_cluster.c
@@ -1,7 +1,8 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  version_test - test program for samba_version_strion()
- *  Copyright (C) Michael Adam 2009
+ *  cluster utility functions
+ *  Copyright (C) Volker Lendecke 2013
+ *  Copyright (C) Michael Adam 2013
  *
  *  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
@@ -18,9 +19,21 @@
  */
 
 #include "includes.h"
+#include "ctdbd_conn.h"
+#include "util_cluster.h"
 
-int main(void)
+bool cluster_probe_ok(void)
 {
-	printf("%s\n", samba_version_string());
-	return 0;
+	if (lp_clustering()) {
+		NTSTATUS status;
+
+		status = ctdbd_probe();
+		if (!NT_STATUS_IS_OK(status)) {
+			DEBUG(0, ("clustering=yes but ctdbd connect failed: "
+				  "%s\n", nt_errstr(status)));
+			return false;
+		}
+	}
+
+	return true;
 }
diff --git a/source3/lib/version_test.c b/source3/lib/util_cluster.h
similarity index 75%
copy from source3/lib/version_test.c
copy to source3/lib/util_cluster.h
index 880cfeb..6d05987 100644
--- a/source3/lib/version_test.c
+++ b/source3/lib/util_cluster.h
@@ -1,7 +1,8 @@
 /*
  *  Unix SMB/CIFS implementation.
- *  version_test - test program for samba_version_strion()
- *  Copyright (C) Michael Adam 2009
+ *  cluster utility functions
+ *  Copyright (C) Volker Lendecke 2013
+ *  Copyright (C) Michael Adam 2013
  *
  *  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
@@ -17,10 +18,10 @@
  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "includes.h"
 
-int main(void)
-{
-	printf("%s\n", samba_version_string());
-	return 0;
-}
+#ifndef __UTIL_CLUSTER_H__
+#define __UTIL_CLUSTER_H__
+
+bool cluster_probe_ok(void);
+
+#endif /* __UTIL_CLUSTER_H__ */
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index ec0e7d0..f31de08 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -26,6 +26,7 @@
 #include "serverid.h"
 #include "messages.h"
 #include "../lib/util/pidfile.h"
+#include "util_cluster.h"
 
 int ClientNMB       = -1;
 int ClientDGRAM     = -1;
@@ -917,6 +918,10 @@ static bool open_sockets(bool isdaemon, int port)
 		exit(1);
 	}
 
+	if (!cluster_probe_ok()) {
+		exit(1);
+	}
+
 	msg = messaging_init(NULL, server_event_context());
 	if (msg == NULL) {
 		return 1;
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index d3cd33e..8173a62 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -31,6 +31,7 @@
 #include "secrets.h"
 #include "memcache.h"
 #include "ctdbd_conn.h"
+#include "util_cluster.h"
 #include "printing/queue_process.h"
 #include "rpc_server/rpc_service_setup.h"
 #include "rpc_server/rpc_config.h"
@@ -1214,6 +1215,10 @@ extern void build_options(bool screen);
 		exit(1);
 	}
 
+	if (!cluster_probe_ok()) {
+		exit(1);
+	}
+
 	/* Init the security context and global current_user */
 	init_sec_ctx();
 
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 31280c2..361d02c 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -37,6 +37,7 @@
 #include "auth.h"
 #include "messages.h"
 #include "../lib/util/pidfile.h"
+#include "util_cluster.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -1464,6 +1465,10 @@ int main(int argc, char **argv, char **envp)
 		exit(1);
 	}
 
+	if (!cluster_probe_ok()) {
+		exit(1);
+	}
+
 	/* Initialise messaging system */
 
 	if (winbind_messaging_context() == NULL) {
diff --git a/source3/wscript_build b/source3/wscript_build
index dd2e054..4803e9b 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -285,6 +285,7 @@ bld.SAMBA3_SUBSYSTEM('samba3core',
                    lib/ctdb_packet.c
                    lib/ctdbd_conn.c
                    lib/ctdb_conn.c
+                   lib/util_cluster.c
                    lib/msg_channel.c
                    lib/id_cache.c
                    lib/talloc_dict.c


-- 
Samba Shared Repository


More information about the samba-cvs mailing list