[SCM] CTDB repository - branch master updated - ctdb-1.12-35-g8959d15

Ronnie Sahlberg sahlberg at samba.org
Thu Nov 17 21:05:01 MST 2011


The branch, master has been updated
       via  8959d15804bb5901356d7beec1ecddb1cabbca52 (commit)
       via  c4ff223096e7dae2e67692825a78c520d30211e0 (commit)
       via  6a57c64c58c77fd9dc7c7a1583d402c3ce0313b1 (commit)
       via  0f6991010cf4e1f0dd9f39243bcc8fff5dcc0524 (commit)
       via  58a1e25e1c563ebede57eea2e8f4e2c5785d01bf (commit)
       via  88f88d86b0d08240f749fb721b8c401c2eeb1099 (commit)
       via  bfa0fe70db195413a6d7a98f46f7a1270aba678c (commit)
       via  c5ef0d1440f1d952784cc67946c414d149722d01 (commit)
       via  8c4a93e77c7d7d0cec6b2afd42c22475f1b5ccdc (commit)
       via  d0e9e8554614bd49ffb9ec3509feaa0e80d0f65d (commit)
       via  41869d42194b74db43a176a068e96e411007e5f2 (commit)
       via  d17efacb3aa6fac61d89f4c88ca17579341c335f (commit)
       via  668358057c1e6b9bbad7209212f9135c5e6241a0 (commit)
       via  82f6108bfbc7e48ca88650297c6a1c6ede0e1c9c (commit)
       via  126cb0d369b2b1aed63801dc4ba0554399e8b7e4 (commit)
       via  fdca12c25e6fce6206135b994dedf44265e4eb09 (commit)
       via  79638bdd884caaf899c1b41984a5f0cf638207b5 (commit)
       via  aaf1ddfc83cf2ede29288baf04a1aa1c69a5cab5 (commit)
       via  ac9236e64bd0b61740cc787819a1222bc6a67d4a (commit)
       via  3084220e2aac3664511969f10cad206e505150a0 (commit)
       via  23c164926c5ec4da6d90a5bdcbf2d0100729b451 (commit)
       via  080edee3d053d770466ebcc976eb1135c80feef8 (commit)
       via  c22e201be15e7d5b788c2f5f7916b553e0faaa2a (commit)
       via  79d31660c7e612f0290fd085203856ad9e70b26f (commit)
       via  d0244fec8d0dd2abd31a8677e2c2b254b030c47b (commit)
       via  1932466c76de2b184c2a257120768ab8c9d6c12a (commit)
       via  f40101a615f8b9826a484e4697bfea6ee2b9ba88 (commit)
       via  3e4fa518f02db75e4e4a7f326a71df226913f8a8 (commit)
       via  788cdbddbc902a5b076d23473450065b551d274d (commit)
      from  a15ec57c26d1bc82af85f74eebae0bd8abde3233 (commit)

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


- Log -----------------------------------------------------------------
commit 8959d15804bb5901356d7beec1ecddb1cabbca52
Merge: c4ff223096e7dae2e67692825a78c520d30211e0 88f88d86b0d08240f749fb721b8c401c2eeb1099
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 18 15:01:13 2011 +1100

    Merge remote branch 'martins/eventscripts'

commit c4ff223096e7dae2e67692825a78c520d30211e0
Merge: 6a57c64c58c77fd9dc7c7a1583d402c3ce0313b1 3084220e2aac3664511969f10cad206e505150a0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 18 14:46:45 2011 +1100

    Merge remote branch 'martins/scriptstatus'

commit 6a57c64c58c77fd9dc7c7a1583d402c3ce0313b1
Merge: 0f6991010cf4e1f0dd9f39243bcc8fff5dcc0524 8c4a93e77c7d7d0cec6b2afd42c22475f1b5ccdc
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 18 14:45:56 2011 +1100

    Merge remote branch 'martins/ctdb_control_oom'

commit 0f6991010cf4e1f0dd9f39243bcc8fff5dcc0524
Merge: 58a1e25e1c563ebede57eea2e8f4e2c5785d01bf d0e9e8554614bd49ffb9ec3509feaa0e80d0f65d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 18 14:42:10 2011 +1100

    Merge remote branch 'martins/hashinclude'

commit 58a1e25e1c563ebede57eea2e8f4e2c5785d01bf
Merge: a15ec57c26d1bc82af85f74eebae0bd8abde3233 79638bdd884caaf899c1b41984a5f0cf638207b5
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Nov 18 14:36:45 2011 +1100

    Merge remote branch 'martins/warnings'

commit 88f88d86b0d08240f749fb721b8c401c2eeb1099
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 17 16:47:00 2011 +1100

    Eventscripts - add facility to 10.interface to delete unmanaged IPs
    
    For a number of reasons (delip failure, admin stupidity, ...) an
    interface that hosts public addresses can also contain spurious,
    unmanaged addresses.
    
    Add functionality to 10.interfaces, controlled by new configuration
    variable CTDB_DELETE_UNEXPECTED_IPS, to delete these addresses when
    encountered as part of a monitor event.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit bfa0fe70db195413a6d7a98f46f7a1270aba678c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Oct 14 15:55:12 2011 +1100

    Eventscripts - remove $0 from error messages in 40.fs_use
    
    The script name is now prepended to output by ctdbd.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit c5ef0d1440f1d952784cc67946c414d149722d01
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Oct 14 15:52:12 2011 +1100

    Eventscripts: Make 40.fs_use use less processes and arguably clearer.
    
    * $fs can be parsed using shell prefix and suffix removal.
    
    * df output can be parsed with a single call to sed.
    
      Failure is indicated by empty output from sed, so we check for that
      as the error condition, changing the associated message
      appropriately.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 8c4a93e77c7d7d0cec6b2afd42c22475f1b5ccdc
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 16 15:25:14 2011 +1100

    Relax an out of memory message.
    
    The call to ctdb_transport_allocate() can fail for 2 reasons:
    
    * Unable to allocate memory.
    
    * The transport is down, perhaps because CTDB is shutting down.
    
    Either cause will be appropriately logged.
    
    The current use of CTDB_NO_MEMORY_VOID() prints an "out of memory"
    message regardless of what happened in ctdb_transport_allocate() and
    this could be misleading.
    
    Change this to print a more relaxed message.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit d0e9e8554614bd49ffb9ec3509feaa0e80d0f65d
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 14:41:47 2011 +1100

    Make some ctdb_takeover.c functions static
    
    These were intentionally not static so they could be linked to in unit
    test programs.  However, using the CCAN-style unit tests where
    relevant code is just included, this is no longer necessary.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 41869d42194b74db43a176a068e96e411007e5f2
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 14:15:52 2011 +1100

    Tests: change ctdb_takeover_tests.c to include ctdbd code
    
    Do this instead of linking to it.  This means that, after previous
    cleanups, we can fix ctdb_takeover.c to use static functions when
    appropriate and simply include all the code we need to run tests.
    
    To make this reusable in other tests, new file ctdbd_tests.c does all
    of the relevant including.  ctdb_takeover_tests.c just includes that
    file.
    
    Test objects built in this way can depend on new Makefile macro
    $(CTDB_TEST_C), which contains ctdbd_tests.c and everything it
    includes.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit d17efacb3aa6fac61d89f4c88ca17579341c335f
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 14:06:21 2011 +1100

    Rename ctdb_control_get_stat_history() local variable to avoid shadowing.
    
    Local variable stat generates a warning because it shadows a global
    declatation, presumably stat(2).  Rename it to s.
    
    This is in the context of wanting to run CCAN-style tests where most
    of the ctdbd code is just included in the test program.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 668358057c1e6b9bbad7209212f9135c5e6241a0
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 14:03:59 2011 +1100

    Rename ctdb_ctrl_getscriptstatus() parameter to avoid shadowing a global
    
    Rename parameter script_status to scripts to avoid shadowing a global
    function with the same name in eventscript.c.
    
    This is in the context of wanting to run CCAN-style tests where most
    of the ctdbd code is just included in the test program.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 82f6108bfbc7e48ca88650297c6a1c6ede0e1c9c
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 14:02:09 2011 +1100

    Rename ctdb_control_destructor() to ctdb_client_control_destructor()
    
    This avoids a name clash with a slightly different function in
    ctdb_control.c.
    
    This is in the context of wanting to run CCAN-style tests where most
    of the ctdbd code is just included in the test program.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 126cb0d369b2b1aed63801dc4ba0554399e8b7e4
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 13:56:46 2011 +1100

    Move some common functions to common/ctdb_ltdb.c
    
    Move identical copies of ctdb_null_func(), ctdb_fetch_func(),
    ctdb_fetch_with_header_func() from ctdb_client.c and
    ctdb_ltdb_server.c to somewhere common.
    
    This is in the context of wanting to run CCAN-style tests where most
    of the ctdbd code is just included in the test program.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit fdca12c25e6fce6206135b994dedf44265e4eb09
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Nov 11 12:41:24 2011 +1100

    Added some #ifndefs to stop files being included multiple times.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 79638bdd884caaf899c1b41984a5f0cf638207b5
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 15:12:25 2011 +1100

    Clean up warnings: rpcgen output contains unused variable.
    
    Grep it out in the Makefile.  This should be very obvious if the
    output changes and the grep breaks something.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit aaf1ddfc83cf2ede29288baf04a1aa1c69a5cab5
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 15:07:55 2011 +1100

    Fix lib/replace
    
    Warnings are generated when compiling strptime.c.  Why is it being
    compiled on Linux?  strptime(3) has been in glibc for 15 years!
    
    It turns out that some of the test fragments were being looked for in
    lib/replace/test/ and some in lib/replace/tests/.  In addition,
    test*/strptime.c was missing.
    
    Move the tests to lib/replace/test/ for consistency with upstream
    (Samba) and copy in test/strptime.c from Samba.  Tweak repdir.m4 to
    handle the directory rename.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit ac9236e64bd0b61740cc787819a1222bc6a67d4a
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 14:16:42 2011 +1100

    Clean up warnings: popt sure does some strange things
    
    popt generates 4 compiler warnings with GCC 4.6.  There are 2
    different types:
    
    * 3 instances of:
    
        warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
    
      One occurs in the _free() hack that is used to try and avoid a
      compiler warning.  I guess GCC got smarter?  ;-)
    
      The other is where an array of constant strings is passed to
      execvp(2), which arguably has the wrong type, since it has no need
      to modify the strings.
    
      Both of these can be worked around by casting to intptr_t before
      casting to the desired argument type.
    
      In poptReadConfigFile() the variable file is declared to be a
      constant string.  However, it is then passed to read(2) straight
      away and an attempt is made to cast away the "const".  However, to
      protect the value the of file is assigned to (const char *) chptr
      before it is passed to any other functions, so this protects the
      value anyway.  I'm not sure exactly what the thinking was
      here... but there seems to be no use having file be constant.
    
    * 1 instance of:
    
        warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
    
      for the result of an execvp(2) call.  Recast the return type to
      void.  However, due to some #if-fu in the function, that can make rc
      unused in this function.  So we also need to wrap the declaration of
      rc in some corresponding #if-fu to make it disappear if not used.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3084220e2aac3664511969f10cad206e505150a0
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 15:41:03 2011 +1100

    Fix ctdb scriptstatus -n all
    
    This didn't have auto_all set as true.  However, there's no special
    code to handle "-n all" and it just fails.  If auto_all works for
    status then it might as well work for scriptstatus.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 23c164926c5ec4da6d90a5bdcbf2d0100729b451
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 14:10:21 2011 +1100

    Clean up warnings: add -Wno-format-zero-length to CFLAGS
    
    There's an empty string passed to ctdb_event_script_callback() for
    eventscript option arguments in ctdb_start_daemon() and this generates
    a warning.
    
    This type of warning seems pointless so let's switch it off.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 080edee3d053d770466ebcc976eb1135c80feef8
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Nov 10 14:08:59 2011 +1100

    Clean up warnings: -Wunused-but-set-variable in tevent_signal.c
    
    Have sent this upstream to Samba.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit c22e201be15e7d5b788c2f5f7916b553e0faaa2a
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 15:47:30 2011 +1100

    Clean up warnings: remove unused function dump_packet()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 79d31660c7e612f0290fd085203856ad9e70b26f
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 15:37:24 2011 +1100

    Clean up warnings: remove unused variable alen from scsi_io
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit d0244fec8d0dd2abd31a8677e2c2b254b030c47b
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 15:36:09 2011 +1100

    Clean up warnings: remove set but unused variable from rb_test
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 1932466c76de2b184c2a257120768ab8c9d6c12a
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 15:20:07 2011 +1100

    Clean up warnings: log some unchecked return codes from function calls
    
    In a few places functions are called, the return code is assigned into
    a variable but it is not checked.  This generates a compiler warning
    like this:
    
      warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
    
    Instead we remove the warning by checking the return code variable and
    log a warning at DEBUG level if the return code indicates an error.
    The justification is that there may have been a future intent to check
    the return code but it hasn't been important enough to follow-up.  If
    it matters, it will be logged for easy debugging.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit f40101a615f8b9826a484e4697bfea6ee2b9ba88
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 14:55:07 2011 +1100

    Fix typo in ctdb_ltdb_store_server()
    
    The if statement uses ret but means to use ret2.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 3e4fa518f02db75e4e4a7f326a71df226913f8a8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 14:45:01 2011 +1100

    Clean up warnings: remove changed_flags in monitor_helper
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 788cdbddbc902a5b076d23473450065b551d274d
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Nov 9 14:41:17 2011 +1100

    Clean up warnings: ‘tevent_loop_allow_nesting’ is deprecated
    
    CTDB wants to use these functions but Samba's tevent wants to mark
    them deprecated.  This adds a #define to shut up the warnings and sets
    it in CFLAGS.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

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

Summary of changes:
 Makefile.in                               |   18 ++-
 client/ctdb_client.c                      |   54 ++-------
 common/ctdb_io.c                          |   15 ---
 common/ctdb_ltdb.c                        |   37 ++++++
 common/rb_tree.h                          |    7 +-
 config/events.d/10.interface              |   29 +++++
 config/events.d/40.fs_use                 |   14 +-
 include/ctdb_private.h                    |   32 +-----
 include/includes.h                        |    5 +
 lib/popt/popt.c                           |    4 +-
 lib/popt/poptconfig.c                     |    3 +-
 lib/popt/poptint.h                        |    2 +-
 lib/replace/repdir.m4                     |    6 +-
 lib/replace/{tests => test}/os2_delete.c  |    0
 lib/replace/{tests => test}/shared_mmap.c |    0
 lib/replace/test/strptime.c               |  173 +++++++++++++++++++++++++++++
 lib/replace/{tests => test}/testsuite.c   |    0
 lib/tevent/tevent.h                       |    7 +
 lib/tevent/tevent_signal.c                |    6 +-
 lib/util/db_wrap.h                        |    4 +
 server/ctdb_call.c                        |    3 +
 server/ctdb_control.c                     |    5 +-
 server/ctdb_ltdb_server.c                 |   41 +-------
 server/ctdb_recoverd.c                    |    3 -
 server/ctdb_statistics.c                  |   12 +-
 server/ctdb_takeover.c                    |   83 ++++++--------
 tcp/ctdb_tcp.h                            |    6 +-
 tests/src/ctdb_bench.c                    |    6 +
 tests/src/ctdb_takeover_tests.c           |   11 +--
 tests/src/ctdbd_test.c                    |   94 ++++++++++++++++
 tests/src/rb_test.c                       |    4 -
 tools/ctdb.c                              |    2 +-
 utils/scsi_io/scsi_io.c                   |    5 +-
 33 files changed, 465 insertions(+), 226 deletions(-)
 rename lib/replace/{tests => test}/os2_delete.c (100%)
 rename lib/replace/{tests => test}/shared_mmap.c (100%)
 create mode 100644 lib/replace/test/strptime.c
 rename lib/replace/{tests => test}/testsuite.c (100%)
 create mode 100644 tests/src/ctdbd_test.c


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index 1f71285..f2c690c 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -37,7 +37,7 @@ CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
        -I at tallocdir@ -I at tdbdir@/include -I at libreplacedir@ \
 	-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
 	-DLOGDIR=\"$(logdir)\" \
-	-DUSE_MMAP=1 @CFLAGS@ $(POPT_CFLAGS)
+	-DUSE_MMAP=1 -DTEVENT_DEPRECATED_QUIET=1 @CFLAGS@ -Wno-format-zero-length $(POPT_CFLAGS)
 
 LIB_FLAGS=@LDFLAGS@ -Llib @LIBS@ $(POPT_LIBS) @INFINIBAND_LIBS@ @CTDB_PCAP_LDFLAGS@
 
@@ -147,7 +147,7 @@ utils/smnotify/smnotify.h:  utils/smnotify/smnotify.x
 
 utils/smnotify/gen_xdr.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
 	@echo Generating $@
-	rpcgen -c utils/smnotify/smnotify.x > utils/smnotify/gen_xdr.c 
+	rpcgen -c utils/smnotify/smnotify.x | grep -Ev '^[[:space:]]+register int32_t \*buf;' > utils/smnotify/gen_xdr.c 
 
 utils/smnotify/gen_smnotify.c: utils/smnotify/smnotify.x utils/smnotify/smnotify.h
 	@echo Generating $@
@@ -217,11 +217,19 @@ tests/bin/ctdb_transaction: $(CTDB_CLIENT_OBJ) tests/src/ctdb_transaction.o
 	@echo Linking $@
 	@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_transaction.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS)
 
-CTDB_TAKEOVER_OBJ = $(CTDB_SERVER_OBJ:server/ctdbd.o=)
+CTDB_SERVER_MOST_OBJ = $(CTDB_SERVER_OBJ:server/ctdbd.o=)
+CTDB_TEST_C = $(CTDB_SERVER_MOST_OBJ:.o=.c) tests/src/ctdbd_test.c
+CTDB_TEST_OBJ =  @TALLOC_OBJ@ @TDB_OBJ@ \
+	@LIBREPLACEOBJ@ $(EXTRA_OBJ) @TEVENT_OBJ@
+
+CTDB_TEST_DEPENDS = $(CTDB_TEST_OBJ) $(CTDB_SERVER_MOST_C) \
+	tests/src/ctdbd_test.c
+
+tests/src/ctdb_takeover_tests.o: tests/src/ctdb_takeover_tests.c $(CTDB_TEST_C)
 
-tests/bin/ctdb_takeover_tests: $(CTDB_TAKEOVER_OBJ) tests/src/ctdb_takeover_tests.o
+tests/bin/ctdb_takeover_tests: $(CTDB_TEST_OBJ) tests/src/ctdb_takeover_tests.o
 	@echo Linking $@
-	@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_takeover_tests.o $(CTDB_TAKEOVER_OBJ) $(LIB_FLAGS)
+	@$(CC) $(CFLAGS) -o $@ tests/src/ctdb_takeover_tests.o $(CTDB_TEST_OBJ) $(LIB_FLAGS)
 
 tests/bin/ibwrapper_test: $(CTDB_CLIENT_OBJ) ib/ibwrapper_test.o
 	@echo Linking $@
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index f0172e4..1d63fa0 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -388,6 +388,9 @@ static struct ctdb_client_call_state *ctdb_client_call_local_send(struct ctdb_db
 	state->ctdb_db = ctdb_db;
 
 	ret = ctdb_call_local(ctdb_db, state->call, header, state, data, true);
+	if (ret != 0) {
+		DEBUG(DEBUG_DEBUG,("ctdb_call_local() failed, ignoring return code %d\n", ret));
+	}
 
 	return state;
 }
@@ -916,6 +919,9 @@ static void invoke_control_callback(struct event_context *ev, struct timed_event
 			NULL, 
 			NULL, 
 			NULL);
+	if (ret != 0) {
+		DEBUG(DEBUG_DEBUG,("ctdb_control_recv() failed, ignoring return code %d\n", ret));
+	}
 
 	talloc_free(tmp_ctx);
 }
@@ -972,7 +978,7 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb,
 /*
   destroy a ctdb_control in client
 */
-static int ctdb_control_destructor(struct ctdb_client_control_state *state)	
+static int ctdb_client_control_destructor(struct ctdb_client_control_state *state)
 {
 	ctdb_reqid_remove(state->ctdb, state->reqid);
 	return 0;
@@ -1029,7 +1035,7 @@ struct ctdb_client_control_state *ctdb_control_send(struct ctdb_context *ctdb,
 	state->state      = CTDB_CONTROL_WAIT;
 	state->errormsg   = NULL;
 
-	talloc_set_destructor(state, ctdb_control_destructor);
+	talloc_set_destructor(state, ctdb_client_control_destructor);
 
 	len = offsetof(struct ctdb_req_control, data) + data.dsize;
 	c = ctdbd_allocate_pkt(ctdb, state, CTDB_REQ_CONTROL, 
@@ -1878,44 +1884,6 @@ int ctdb_statistics_reset(struct ctdb_context *ctdb, uint32_t destnode)
 }
 
 /*
-  this is the dummy null procedure that all databases support
-*/
-static int ctdb_null_func(struct ctdb_call_info *call)
-{
-	return 0;
-}
-
-/*
-  this is a plain fetch procedure that all databases support
-*/
-static int ctdb_fetch_func(struct ctdb_call_info *call)
-{
-	call->reply_data = &call->record_data;
-	return 0;
-}
-
-/*
-  this is a plain fetch procedure that all databases support
-  this returns the full record including the ltdb header
-*/
-static int ctdb_fetch_with_header_func(struct ctdb_call_info *call)
-{
-	call->reply_data = talloc(call, TDB_DATA);
-	if (call->reply_data == NULL) {
-		return -1;
-	}
-	call->reply_data->dsize = sizeof(struct ctdb_ltdb_header) + call->record_data.dsize;
-	call->reply_data->dptr  = talloc_size(call->reply_data, call->reply_data->dsize);
-	if (call->reply_data->dptr == NULL) {
-		return -1;
-	}
-	memcpy(call->reply_data->dptr, call->header, sizeof(struct ctdb_ltdb_header));
-	memcpy(&call->reply_data->dptr[sizeof(struct ctdb_ltdb_header)], call->record_data.dptr, call->record_data.dsize);
-
-	return 0;
-}
-
-/*
   attach to a specific database - client call
 */
 struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
@@ -4125,7 +4093,7 @@ int switch_from_server_to_client(struct ctdb_context *ctdb, const char *fmt, ...
 int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb, 
 		struct timeval timeout, uint32_t destnode, 
 		TALLOC_CTX *mem_ctx, enum ctdb_eventscript_call type,
-		struct ctdb_scripts_wire **script_status)
+		struct ctdb_scripts_wire **scripts)
 {
 	int ret;
 	TDB_DATA outdata, indata;
@@ -4144,9 +4112,9 @@ int ctdb_ctrl_getscriptstatus(struct ctdb_context *ctdb,
 	}
 
 	if (outdata.dsize == 0) {
-		*script_status = NULL;
+		*scripts = NULL;
 	} else {
-		*script_status = (struct ctdb_scripts_wire *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
+		*scripts = (struct ctdb_scripts_wire *)talloc_memdup(mem_ctx, outdata.dptr, outdata.dsize);
 		talloc_free(outdata.dptr);
 	}
 		    
diff --git a/common/ctdb_io.c b/common/ctdb_io.c
index 0f44b87..86e54e0 100644
--- a/common/ctdb_io.c
+++ b/common/ctdb_io.c
@@ -64,21 +64,6 @@ int ctdb_queue_length(struct ctdb_queue *queue)
 	return queue->out_queue_length;
 }
 
-static void dump_packet(unsigned char *data, size_t len)
-{
-	size_t i;
-	char *p = talloc_array(NULL, char, len*3 + 1);
-	if (!p) {
-		DEBUG(DEBUG_CRIT,("Packet talloc fail"));
-		return;
-	}
-
-	for (i = 0; i < len; i++)
-		sprintf(p + i*3, " %02x", data[i]);
-	DEBUG(DEBUG_CRIT,("Contents: %s\n", p));
-	talloc_free(p);
-}
-
 /*
   called when an incoming connection is readable
   This function MUST be safe for reentry via the queue callback!
diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index e4662ac..565a899 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -295,4 +295,41 @@ void ctdb_trackingdb_traverse(struct ctdb_context *ctdb, TDB_DATA data, ctdb_tra
 	}
 }
 
+/*
+  this is the dummy null procedure that all databases support
+*/
+int ctdb_null_func(struct ctdb_call_info *call)
+{
+	return 0;
+}
+
+/*
+  this is a plain fetch procedure that all databases support
+*/
+int ctdb_fetch_func(struct ctdb_call_info *call)
+{
+	call->reply_data = &call->record_data;
+	return 0;
+}
+
+/*
+  this is a plain fetch procedure that all databases support
+  this returns the full record including the ltdb header
+*/
+int ctdb_fetch_with_header_func(struct ctdb_call_info *call)
+{
+	call->reply_data = talloc(call, TDB_DATA);
+	if (call->reply_data == NULL) {
+		return -1;
+	}
+	call->reply_data->dsize = sizeof(struct ctdb_ltdb_header) + call->record_data.dsize;
+	call->reply_data->dptr  = talloc_size(call->reply_data, call->reply_data->dsize);
+	if (call->reply_data->dptr == NULL) {
+		return -1;
+	}
+	memcpy(call->reply_data->dptr, call->header, sizeof(struct ctdb_ltdb_header));
+	memcpy(&call->reply_data->dptr[sizeof(struct ctdb_ltdb_header)], call->record_data.dptr, call->record_data.dsize);
+
+	return 0;
+}
 
diff --git a/common/rb_tree.h b/common/rb_tree.h
index 4f2ab22..b5ddbb2 100644
--- a/common/rb_tree.h
+++ b/common/rb_tree.h
@@ -17,8 +17,9 @@
    along with this program; if not, see <http://www.gnu.org/licenses/>.
 */
 
-
-
+#ifndef _RB_TREE_H
+#define _RB_TREE_H
+ 
 #define TRBT_RED		0x00
 #define TRBT_BLACK		0x01
 typedef struct trbt_node {
@@ -85,3 +86,5 @@ int trbt_traversearray32(trbt_tree_t *tree, uint32_t keylen, int (*callback)(voi
 /* Lookup the first node in the tree with a key based on an array of uint32 
    and return a pointer to data or NULL */
 void *trbt_findfirstarray32(trbt_tree_t *tree, uint32_t keylen);
+
+#endif /* _RB_TREE_H */
diff --git a/config/events.d/10.interface b/config/events.d/10.interface
index dd54f1e..a425e27 100755
--- a/config/events.d/10.interface
+++ b/config/events.d/10.interface
@@ -49,10 +49,39 @@ get_all_interfaces ()
     all_interfaces=$(echo $all_interfaces $ctdb_ifaces | tr ' ' '\n' | sort -u)
 }
 
+delete_unexpected_ips ()
+{
+    [ "$CTDB_DELETE_UNEXPECTED_IPS" = "yes" ] || return
+
+    for _i in $all_interfaces ; do
+	# Get the IPs actually on this interface
+	_ips=$(ip addr show dev "$_i" | \
+	    sed -n -e 's at .*inet[[:space:]]*\([^[:space:]]*\).*scope global.*@\1 at p')
+	for _ip in $_ips ; do
+
+	    # The NATGW address is OK
+	    if [ "$CTDB_NATGW_PUBLIC_IP" = "$_ip" -a \
+		"$CTDB_NATGW_PUBLIC_IFACE" = "$_i" ] ; then
+		continue
+	    fi
+
+	    # If CTDB knows about the address then it is OK
+	    if ctdb ipinfo "${_ip%/*}" >/dev/null 2>&1 ; then
+		continue
+	    fi
+
+	    echo "WARNING: Removing unmanaged IP address $_ip from interface $_i"
+	    delete_ip_from_iface "$_i" "${_ip%/*}" "${_ip#*/}"
+	done
+    done
+}
+
 monitor_interfaces()
 {
 	get_all_interfaces
 
+	delete_unexpected_ips
+
 	fail=false
 	up_interfaces_found=false
 
diff --git a/config/events.d/40.fs_use b/config/events.d/40.fs_use
index abbc17e..7dd4cc3 100644
--- a/config/events.d/40.fs_use
+++ b/config/events.d/40.fs_use
@@ -11,27 +11,27 @@ case "$1" in
         for fs in $CTDB_CHECK_FS_USE
         do
             # parse fs_mount and fs_threshold
-            fs_mount=`echo "$fs" | awk -F : '{print $1}'`
-            fs_threshold=`echo "$fs" | awk -F : '{print $2}'`
+            fs_mount="${fs%:*}"
+            fs_threshold="${fs#*:}"
 
             # check if given fs_mount is existing directory
             if [ ! -d "$fs_mount" ]; then
-                echo "$0: Directory $fs_mount does not exist"
+                echo "Directory $fs_mount does not exist"
                 exit 1
             fi
 
             # check if given fs_threshold is number
             if ! (echo "$fs_threshold" | egrep -q '^[0-9]+$')  ; then
-                echo "$0: Threshold $fs_threshold is invalid number"
+                echo "Threshold $fs_threshold is invalid number"
                 exit 1
             fi
 
             # get utilization of given fs from df
-            fs_usage=`df -kP $fs_mount | grep '%' | awk {'print $5'} | sed 's/%//g' | tail -n 1`
+            fs_usage=$(df -kP $fs_mount | sed -n -e 's at .*[[:space:]]\([[:digit:]]*\)%.*@\1 at p')
 
             # check if fs_usage is number
-            if ! (echo "$fs_usage" | egrep -q '^[0-9]+$') ; then
-                echo "$0: FS utilization $fs_usage is invalid number"
+            if [ -z "$fs_usage" ] ; then
+                echo "Unable to get FS utilization for $fs_mount"
                 exit 1
             fi
 
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index f1818b9..0d89e5e 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1432,32 +1432,6 @@ struct ctdb_public_ip_list {
 	uint32_t pnn;
 	ctdb_sock_addr addr;
 };
-uint32_t ip_distance(ctdb_sock_addr *ip1, ctdb_sock_addr *ip2);
-uint32_t ip_distance_2_sum(ctdb_sock_addr *ip,
-			   struct ctdb_public_ip_list *ips,
-			   int pnn);
-uint32_t lcp2_imbalance(struct ctdb_public_ip_list * all_ips, int pnn);
-void lcp2_init(struct ctdb_context * tmp_ctx,
-	       struct ctdb_node_map * nodemap,
-	       uint32_t mask,
-	       struct ctdb_public_ip_list *all_ips,
-	       uint32_t **lcp2_imbalances,
-	       bool **newly_healthy);
-void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
-			      struct ctdb_node_map *nodemap,
-			      uint32_t mask,
-			      struct ctdb_public_ip_list *all_ips,
-			      uint32_t *lcp2_imbalances);
-bool lcp2_failback(struct ctdb_context *ctdb,
-		   struct ctdb_node_map *nodemap,
-		   uint32_t mask,
-		   struct ctdb_public_ip_list *all_ips,
-		   uint32_t *lcp2_imbalances,
-		   bool *newly_healthy);
-void ctdb_takeover_run_core(struct ctdb_context *ctdb,
-			    struct ctdb_node_map *nodemap,
-			    struct ctdb_public_ip_list **all_ips_p);
-
 int ctdb_trackingdb_add_pnn(struct ctdb_context *ctdb, TDB_DATA *data, uint32_t pnn);
 
 typedef void (*ctdb_trackingdb_cb)(struct ctdb_context *ctdb, uint32_t pnn, void *private_data);
@@ -1472,4 +1446,10 @@ int ctdb_add_revoke_deferred_call(struct ctdb_context *ctdb, struct ctdb_db_cont
 
 int ctdb_set_db_readonly(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_db);
 
+int ctdb_null_func(struct ctdb_call_info *call);
+
+int ctdb_fetch_func(struct ctdb_call_info *call);
+
+int ctdb_fetch_with_header_func(struct ctdb_call_info *call);
+
 #endif
diff --git a/include/includes.h b/include/includes.h
index b3f8eb9..b7d1e76 100644
--- a/include/includes.h
+++ b/include/includes.h
@@ -1,3 +1,6 @@
+#ifndef _CTDB_INCLUDES_H
+#define _CTDB_INCLUDES_H
+
 #define HAVE_UNIXSOCKET 1
 
 #include "replace.h"
@@ -58,3 +61,5 @@ _PUBLIC_ int set_blocking(int fd, BOOL set);
 
 #include "lib/util/debug.h"
 #include "lib/util/util.h"
+
+#endif /* _CTDB_INCLUDES_H */
diff --git a/lib/popt/popt.c b/lib/popt/popt.c
index 4f1de65..33a5ec7 100644
--- a/lib/popt/popt.c
+++ b/lib/popt/popt.c
@@ -368,7 +368,9 @@ static int execCommand(poptContext con)
     poptItem item = con->doExec;
     const char ** argv;
     int argc = 0;
+#if defined(__hpux) || defined(HAVE_SETUID) || defined(HAVE_SETREUID)
     int rc;
+#endif
 
     if (item == NULL) /*XXX can't happen*/
 	return POPT_ERROR_NOARG;
@@ -444,7 +446,7 @@ if (_popt_debug)
     }
 #endif
 
-    rc = execvp(argv[0], (char *const *)argv);
+    (void) execvp(argv[0], (char *const *)(intptr_t)argv);
 
     return POPT_ERROR_ERRNO;
 }
diff --git a/lib/popt/poptconfig.c b/lib/popt/poptconfig.c
index a600a92..5edf916 100644
--- a/lib/popt/poptconfig.c
+++ b/lib/popt/poptconfig.c
@@ -94,7 +94,8 @@ static void configLine(poptContext con, char * line)
 
 int poptReadConfigFile(poptContext con, const char * fn)
 {
-    const char * file, * chptr, * end;
+    char * file;
+    const char * chptr, * end;
     char * buf;
 /*@dependent@*/ char * dst;
     int fd, rc;
diff --git a/lib/popt/poptint.h b/lib/popt/poptint.h
index 5d308ef..d078997 100644
--- a/lib/popt/poptint.h
+++ b/lib/popt/poptint.h
@@ -18,7 +18,7 @@
 _free(/*@only@*/ /*@null@*/ const void * p)
 	/*@modifies p @*/
 {
-    if (p != NULL)	free((void *)p);
+    if (p != NULL)	free((void *)(intptr_t)p);
     return NULL;
 }
 
diff --git a/lib/replace/repdir.m4 b/lib/replace/repdir.m4
index bbd111f..f53a4c2 100644
--- a/lib/replace/repdir.m4
+++ b/lib/replace/repdir.m4
@@ -1,7 +1,7 @@
 AC_CACHE_CHECK([for broken readdir],libreplace_cv_READDIR_NEEDED,[
 	AC_TRY_RUN([
 #define test_readdir_os2_delete main
-#include "$libreplacedir/tests/os2_delete.c"],
+#include "$libreplacedir/test/os2_delete.c"],
 	[libreplace_cv_READDIR_NEEDED=no],
 	[libreplace_cv_READDIR_NEEDED=yes],
 	[libreplace_cv_READDIR_NEEDED="assuming not"])
@@ -34,7 +34,7 @@ AC_CACHE_CHECK([for replacing readdir using getdirentries()],libreplace_cv_READD
 #define _LIBREPLACE_REPLACE_H
 #include "$libreplacedir/repdir_getdirentries.c"
 #define test_readdir_os2_delete main
-#include "$libreplacedir/tests/os2_delete.c"],
+#include "$libreplacedir/test/os2_delete.c"],
 	[libreplace_cv_READDIR_GETDIRENTRIES=yes],
 	[libreplace_cv_READDIR_GETDIRENTRIES=no])
 ])
@@ -57,7 +57,7 @@ AC_CACHE_CHECK([for replacing readdir using getdents()],libreplace_cv_READDIR_GE
 #error _donot_use_getdents_replacement_anymore
 #include "$libreplacedir/repdir_getdents.c"
 #define test_readdir_os2_delete main
-#include "$libreplacedir/tests/os2_delete.c"],
+#include "$libreplacedir/test/os2_delete.c"],
 	[libreplace_cv_READDIR_GETDENTS=yes],
 	[libreplace_cv_READDIR_GETDENTS=no])
 ])
diff --git a/lib/replace/tests/os2_delete.c b/lib/replace/test/os2_delete.c
similarity index 100%
rename from lib/replace/tests/os2_delete.c
rename to lib/replace/test/os2_delete.c
diff --git a/lib/replace/tests/shared_mmap.c b/lib/replace/test/shared_mmap.c
similarity index 100%
rename from lib/replace/tests/shared_mmap.c
rename to lib/replace/test/shared_mmap.c
diff --git a/lib/replace/test/strptime.c b/lib/replace/test/strptime.c
new file mode 100644
index 0000000..5bf03f5
--- /dev/null
+++ b/lib/replace/test/strptime.c
@@ -0,0 +1,173 @@
+
+#ifdef LIBREPLACE_CONFIGURE_TEST_STRPTIME
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
+
+#define true 1
+#define false 0
+


-- 
CTDB repository


More information about the samba-cvs mailing list