[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Mar 31 10:56:02 MDT 2011


The branch, master has been updated
       via  1877508 s3:configure: allow building without SCHEDULE_FOR_DELETION with --enable-old-ctdb
       via  7b9648c s3:configure: introduce "--enable-old-ctdb" to enable enforcing build against old ctdb
       via  69aead6 s3:configure: add check for new CTDB_CONTROL_SCHEDULE_FOR_DELETION
       via  e9e23cc s3:configure: rework logic of ctdb/clustering checks
       via  a9b04e4 s3:configure: remove unused variable CTDB_CFLAGS
       via  0943d39 s3:configure: fix a comment.
       via  3a3c118 s3:dbwrap_ctdb: in ctdb_delete, send a SCHEDULE_FOR_DELETION control to local ctdbd
       via  0e240bd s3:ctdb: pass the ctdb control flags to the ctdb daemon when sending the control
       via  6cc8457 s3:ctdb: samba can now handle the NOREPLY flag
       via  fd41b4f s3:ctdb: correctly handle cstatus if CTDB_CTRL_FLAG_NOREPLY is set.
      from  34ea813 s3-net: Do not use uninitialized value

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


- Log -----------------------------------------------------------------
commit 1877508856264e8266200fc4e49795e3496b7292
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 16:12:02 2011 +0200

    s3:configure: allow building without SCHEDULE_FOR_DELETION with --enable-old-ctdb
    
    Autobuild-User: Michael Adam <obnox at samba.org>
    Autobuild-Date: Thu Mar 31 18:55:38 CEST 2011 on sn-devel-104

commit 7b9648c08699161661e0f6db681281e7af88d6e4
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 16:06:36 2011 +0200

    s3:configure: introduce "--enable-old-ctdb" to enable enforcing build against old ctdb

commit 69aead60e27695d19aeda6226a91e1358d070f03
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 15:39:41 2011 +0200

    s3:configure: add check for new CTDB_CONTROL_SCHEDULE_FOR_DELETION

commit e9e23cc948f88974c94b3221fc65be093197bcb2
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 15:23:28 2011 +0200

    s3:configure: rework logic of ctdb/clustering checks

commit a9b04e4a79b1c45a8b08a5fbdb18f818a1efa9f0
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 14:17:44 2011 +0200

    s3:configure: remove unused variable CTDB_CFLAGS

commit 0943d39cd646bfd63ce6256324bd34af826f9893
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 13:45:21 2011 +0200

    s3:configure: fix a comment.

commit 3a3c118a7edf679d6b545df035fd8d51b00e0830
Author: Michael Adam <obnox at samba.org>
Date:   Wed Dec 22 14:16:07 2010 +0100

    s3:dbwrap_ctdb: in ctdb_delete, send a SCHEDULE_FOR_DELETION control to local ctdbd
    
    This way, the record will be scheduled for fast vacuuming.
    
    This is sent with the NOREPLY flag, so ctd should not sent
    a reply packet and samba does not expect one. Hence, it
    is not important for the success of the db_ctdb_delete command
    whether or not the ctdbd we are running against supports the
    SCHEDULE_FOR_DELETION control.

commit 0e240bd6a96f1270509bd12e7b083bef7d55e99f
Author: Michael Adam <obnox at samba.org>
Date:   Tue Mar 8 16:26:34 2011 +0100

    s3:ctdb: pass the ctdb control flags to the ctdb daemon when sending the control
    
    The only flag that is currently used is the NOREPLY flag to indicate that
    the client expects no reply packet. This needs to get passed down to the
    ctdb daemon so that it really does not send a reply.

commit 6cc8457cd52437eaa0a1e9f3e16b5d334da27da5
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 16:46:24 2010 +0100

    s3:ctdb: samba can now handle the NOREPLY flag
    
    Revert "samba3 can't handle NOREPLY yet"
    
    This reverts commit 9bf211db6d7d6ef6e59508de69d6d8dfe5bae059.

commit fd41b4f1a6fc03f85cd769429765b02cc07b4847
Author: Michael Adam <obnox at samba.org>
Date:   Thu Dec 23 16:43:55 2010 +0100

    s3:ctdb: correctly handle cstatus if CTDB_CTRL_FLAG_NOREPLY is set.

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

Summary of changes:
 source3/configure.in      |  219 +++++++++++++++++++++++++++++----------------
 source3/lib/ctdbd_conn.c  |    7 +-
 source3/lib/dbwrap_ctdb.c |   57 ++++++++++++-
 3 files changed, 201 insertions(+), 82 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/configure.in b/source3/configure.in
index 6033b0b..f0d54cc 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -5399,11 +5399,20 @@ if test x"$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT" = x"yes"; then
 fi
 AC_MSG_RESULT([$samba_cv_HAVE_EXPLICIT_LARGEFILE_SUPPORT])
 
+
 #################################################
 # check for cluster extensions
 
-CTDB_CFLAGS=""
-AC_SUBST(CTDB_CFLAGS)
+AC_MSG_CHECKING(cluster support)
+AC_ARG_WITH(cluster-support,
+[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
+
+if test x"$with_cluster_support" = x ; then
+	with_cluster_support="auto"
+fi
+
+AC_MSG_RESULT($with_cluster_support)
+
 AC_ARG_WITH(ctdb,
 [AS_HELP_STRING([--with-ctdb=DIR], [Where to find ctdb sources])],
 [ case "$withval" in
@@ -5415,9 +5424,21 @@ AC_ARG_WITH(ctdb,
     ;;
   esac])
 
+AC_ARG_ENABLE(old-ctdb,
+	[AS_HELP_STRING([--enable-old-ctdb],
+		[Enable build against (too) old ctdb version (default=no)])],,
+		[enable_old_ctdb=no])
+
+
+if test "$with_cluster_support" != "no" ; then
+
+AC_MSG_NOTICE(checking whether cluster support is available)
+
+have_cluster_support="yes"
+ctdb_broken="no"
+
 SAVED_CPPFLAGS="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS ${SAMBA_CONFIGURE_CPPFLAGS} $CTDB_CPPFLAGS"
-ctdb_broken="missing or broken headers"
 
 AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
 #include "confdefs.h"
@@ -5431,99 +5452,141 @@ AC_CHECK_HEADERS(ctdb.h ctdb_private.h,,,[
 #include <ctdb.h>
 ])
 
-AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" = x"yes"; then
-	ctdb_broken=no
-else
-	ctdb_broken="ctdb transaction support missing or too old"
+if test "x$have_cluster_support" = "xyes" -a \
+	"x$ac_cv_header_ctdb_h" != "xyes"
+then
+	have_cluster_support=no
+	ctdb_broken="ctdb.h is required for cluster support"
 fi
 
-# in ctdb 1.0.57 ctdb_control_tcp was temparary renamed to ctdb_tcp_client
-AC_CHECK_TYPE(struct ctdb_tcp_client,[
-	AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
-],,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-
-AC_CHECK_TYPE(struct ctdb_control_tcp,[
-	AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
-],[
-	ctdb_broken="missing struct ctdb_control_tcp"
-],[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
+if test "x$have_cluster_support" = "xyes" -a \
+	"x$ac_cv_header_ctdb_h" != "xyes"
+then
+	have_cluster_support=no
+	ctdb_broken="ctdb_private.h is required for cluster support"
+fi
+
+
+if test "x$have_cluster_support" = "xyes" ; then
+	AC_HAVE_DECL(CTDB_CONTROL_TRANS3_COMMIT,[
+	#include "confdefs.h"
+	#define NO_CONFIG_H
+	#include "replace.h"
+	#include "system/wait.h"
+	#include "system/network.h"
+	#include <talloc.h>
+	#include <tdb.h>
+	#include <ctdb.h>
+	#include <ctdb_private.h>
+	])
+	if test x"$ac_cv_have_CTDB_CONTROL_TRANS3_COMMIT_decl" != x"yes"; then
+		ctdb_broken="ctdb transaction support missing or too old"
+		have_cluster_support=no
+	fi
+fi
 
-AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
-	AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
-],,[
-#include "confdefs.h"
-#define NO_CONFIG_H
-#include "replace.h"
-#include "system/wait.h"
-#include "system/network.h"
-#include <talloc.h>
-#include <tdb.h>
-#include <ctdb.h>
-#include <ctdb_private.h>
-])
-CPPFLAGS="$SAVED_CPPFLAGS"
+if test "x$have_cluster_support" = "xyes" ; then
+	AC_HAVE_DECL(CTDB_CONTROL_SCHEDULE_FOR_DELETION,[
+	#include "confdefs.h"
+	#define NO_CONFIG_H
+	#include "replace.h"
+	#include "system/wait.h"
+	#include "system/network.h"
+	#include <talloc.h>
+	#include <tdb.h>
+	#include <ctdb.h>
+	#include <ctdb_private.h>
+	])
+	if test x"$ac_cv_have_CTDB_CONTROL_SCHEDULE_FOR_DELETION_decl" != x"yes"
+	then
+		if test "x$enable_old_ctdb" = "xyes" ; then
+			AC_MSG_WARN([ignoring missing SCHEDULE_FOR_DELETION (--enable-old-ctdb)])
+		else
+			ctdb_broken="support for SCHEDULE_FOR_DELETION control missing"
+			have_cluster_support=no
+		fi
+	fi
+fi
 
-AC_MSG_CHECKING(cluster support)
-AC_ARG_WITH(cluster-support,
-[AS_HELP_STRING([--with-cluster-support], [Enable cluster extensions (default=auto)])])
+if test "x$have_cluster_support" = "xyes" ; then
+	# In ctdb 1.0.57, ctdb_control_tcp was temporarily renamed
+	# to ctdb_tcp_client.
+	AC_CHECK_TYPE(struct ctdb_tcp_client,[
+		AC_DEFINE([ctdb_control_tcp],[ctdb_tcp_client],[ctdb ipv4 support])
+	],,[
+	#include "confdefs.h"
+	#define NO_CONFIG_H
+	#include "replace.h"
+	#include "system/wait.h"
+	#include "system/network.h"
+	#include <talloc.h>
+	#include <tdb.h>
+	#include <ctdb.h>
+	#include <ctdb_private.h>
+	])
+fi
 
-if test x"$with_cluster_support" = x ; then
-	with_cluster_support="auto"
+if test "x$have_cluster_support" = "xyes" ; then
+	AC_CHECK_TYPE(struct ctdb_control_tcp,[
+		AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP],[1],[ctdb ipv4 support])
+	],[
+		ctdb_broken="missing struct ctdb_control_tcp"
+		have_cluster_support=no
+	],[
+	#include "confdefs.h"
+	#define NO_CONFIG_H
+	#include "replace.h"
+	#include "system/wait.h"
+	#include "system/network.h"
+	#include <talloc.h>
+	#include <tdb.h>
+	#include <ctdb.h>
+	#include <ctdb_private.h>
+	])
 fi
 
-if test x"$ac_cv_header_ctdb_private_h" != x"yes"; then
-	if test "x$with_cluster_support" = "xyes"; then
-		AC_MSG_ERROR("ctdb_private.h is required for cluster support")
-	fi
-	with_cluster_support=no
+# test for optional ipv6 support in ctdb:
+if test "x$have_cluster_support" = "xyes" ; then
+	AC_CHECK_TYPE(struct ctdb_control_tcp_addr,[
+		AC_DEFINE([HAVE_STRUCT_CTDB_CONTROL_TCP_ADDR],[1],[ctdb ipv6 support])
+	],,[
+	#include "confdefs.h"
+	#define NO_CONFIG_H
+	#include "replace.h"
+	#include "system/wait.h"
+	#include "system/network.h"
+	#include <talloc.h>
+	#include <tdb.h>
+	#include <ctdb.h>
+	#include <ctdb_private.h>
+	])
 fi
 
-if test x"$ctdb_broken" != x"no"; then
-	if test "x$with_cluster_support" = "xyes"; then
-		AC_MSG_ERROR(["cluster support: $ctdb_broken"])
-	fi
+CPPFLAGS="$SAVED_CPPFLAGS"
+
+fi # (if test "$with_cluster_support" != "no")
+
+if test x"$have_cluster_support" = "xno" ; then
+	case "$with_cluster_support" in
+	yes)
+		AC_MSG_ERROR(["cluster support not available: $ctdb_broken"])
+		;;
+	auto)
+		AC_MSG_WARN(["cluster support not available: $ctdb_broken"])
+		;;
+	esac
 	with_cluster_support=no
 fi
 
 if test "x$with_cluster_support" != "xno"; then
     AC_DEFINE(CLUSTER_SUPPORT,1,[Whether to enable cluster extensions])
     SAMBA_CPPFLAGS="${SAMBA_CPPFLAGS} ${CTDB_CPPFLAGS}"
-    AC_MSG_RESULT(yes)
+    AC_MSG_NOTICE(Building with cluster support)
 else
-    AC_MSG_RESULT(no)
+    AC_MSG_NOTICE(Building without cluster support)
 fi
 
+
 #################################################
 # check for rtnetlink
 
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c
index 8e0eeee..a81691a 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -796,9 +796,6 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
 	struct ctdbd_connection *new_conn = NULL;
 	NTSTATUS status;
 
-	/* the samba3 ctdb code can't handle NOREPLY yet */
-	flags &= ~CTDB_CTRL_FLAG_NOREPLY;
-
 	if (conn == NULL) {
 		status = ctdbd_init_connection(NULL, &new_conn);
 
@@ -821,6 +818,7 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
 	req.opcode           = opcode;
 	req.srvid            = srvid;
 	req.datalen          = data.dsize;
+	req.flags            = flags;
 
 	DEBUG(10, ("ctdbd_control: Sending ctdb packet\n"));
 	ctdb_packet_dump(&req.hdr);
@@ -844,6 +842,9 @@ static NTSTATUS ctdbd_control(struct ctdbd_connection *conn,
 
 	if (flags & CTDB_CTRL_FLAG_NOREPLY) {
 		TALLOC_FREE(new_conn);
+		if (cstatus) {
+			*cstatus = 0;
+		}
 		return NT_STATUS_OK;
 	}
 
diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c
index 2d54390..f9a7dd6 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -909,9 +909,56 @@ static NTSTATUS db_ctdb_store(struct db_record *rec, TDB_DATA data, int flag)
 
 
 
+#ifdef CTDB_CONTROL_SCHEDULE_FOR_DELETION
+static NTSTATUS db_ctdb_send_schedule_for_deletion(struct db_record *rec)
+{
+	NTSTATUS status;
+	struct ctdb_control_schedule_for_deletion *dd;
+	TDB_DATA indata;
+	int cstatus;
+	struct db_ctdb_rec *crec = talloc_get_type_abort(
+		rec->private_data, struct db_ctdb_rec);
+
+	indata.dsize = offsetof(struct ctdb_control_schedule_for_deletion, key) + rec->key.dsize;
+	indata.dptr = talloc_zero_array(crec, uint8_t, indata.dsize);
+	if (indata.dptr == NULL) {
+		DEBUG(0, (__location__ " talloc failed!\n"));
+		return NT_STATUS_NO_MEMORY;
+	}
+
+	dd = (struct ctdb_control_schedule_for_deletion *)(void *)indata.dptr;
+	dd->db_id = crec->ctdb_ctx->db_id;
+	dd->hdr = crec->header;
+	dd->keylen = rec->key.dsize;
+	memcpy(dd->key, rec->key.dptr, rec->key.dsize);
+
+	status = ctdbd_control_local(messaging_ctdbd_connection(),
+				     CTDB_CONTROL_SCHEDULE_FOR_DELETION,
+				     crec->ctdb_ctx->db_id,
+				     CTDB_CTRL_FLAG_NOREPLY, /* flags */
+				     indata,
+				     NULL, /* outdata */
+				     NULL, /* errmsg */
+				     &cstatus);
+	talloc_free(indata.dptr);
+
+	if (!NT_STATUS_IS_OK(status) || cstatus != 0) {
+		DEBUG(1, (__location__ " Error sending local control "
+			  "SCHEDULE_FOR_DELETION: %s, cstatus = %d\n",
+			  nt_errstr(status), cstatus));
+		if (NT_STATUS_IS_OK(status)) {
+			status = NT_STATUS_UNSUCCESSFUL;
+		}
+	}
+
+	return status;
+}
+#endif
+
 static NTSTATUS db_ctdb_delete(struct db_record *rec)
 {
 	TDB_DATA data;
+	NTSTATUS status;
 
 	/*
 	 * We have to store the header with empty data. TODO: Fix the
@@ -920,8 +967,16 @@ static NTSTATUS db_ctdb_delete(struct db_record *rec)
 
 	ZERO_STRUCT(data);
 
-	return db_ctdb_store(rec, data, 0);
+	status = db_ctdb_store(rec, data, 0);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
 
+#ifdef CTDB_CONTROL_SCHEDULE_FOR_DELETION
+	status = db_ctdb_send_schedule_for_deletion(rec);
+#endif
+
+	return status;
 }
 
 static int db_ctdb_record_destr(struct db_record* data)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list