[SCM] Samba Shared Repository - branch v3-6-test updated

Michael Adam obnox at samba.org
Thu Mar 31 13:26:59 MDT 2011


The branch, v3-6-test has been updated
       via  4d105c9 s3:configure: allow building without SCHEDULE_FOR_DELETION with --enable-old-ctdb
       via  6a598b2 s3:configure: introduce "--enable-old-ctdb" to enable enforcing build against old ctdb
       via  6b28d24 s3:configure: add check for new CTDB_CONTROL_SCHEDULE_FOR_DELETION
       via  da0334a s3:configure: rework logic of ctdb/clustering checks
       via  f6bfa58 s3:configure: remove unused variable CTDB_CFLAGS
       via  1eb2e59 s3:configure: fix a comment.
       via  6a3b6c8 s3:dbwrap_ctdb: in ctdb_delete, send a SCHEDULE_FOR_DELETION control to local ctdbd
       via  3c9ae69 s3:ctdb: pass the ctdb control flags to the ctdb daemon when sending the control
       via  c1f3d00 s3:ctdb: correctly handle cstatus if CTDB_CTRL_FLAG_NOREPLY is set.
      from  d989660 Fix bug #7996 - sgid bit lost on folder rename.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit 4d105c9c30fea6d5d2a9d2e7939c54bb2f31910d
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 6a598b2ec0330019e677129156d6e27dbb18a225
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 6b28d242f0d3fc2027f609c762855afae69c1deb
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 da0334ac036eb535b6ff0f7f595f61c1f712ca45
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 f6bfa5814fb6e075db97b3bde981fa52a026df00
Author: Michael Adam <obnox at samba.org>
Date:   Thu Mar 31 14:17:44 2011 +0200

    s3:configure: remove unused variable CTDB_CFLAGS

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

    s3:configure: fix a comment.

commit 6a3b6c8f7c14274e98c5c8e14ebf54ea260b2ecf
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 3c9ae69f34ba444bfcdc93923b2eee9ecde419de
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 c1f3d00263a7476564c5e758d80aca0b3fe8b8a5
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  |    4 +
 source3/lib/dbwrap_ctdb.c |   57 ++++++++++++-
 3 files changed, 201 insertions(+), 79 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 16e8cb9..254116e 100644
--- a/source3/lib/ctdbd_conn.c
+++ b/source3/lib/ctdbd_conn.c
@@ -822,6 +822,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);
@@ -845,6 +846,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 46ec6de..90c4771 100644
--- a/source3/lib/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap_ctdb.c
@@ -908,9 +908,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
@@ -919,8 +966,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