[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.2-78-ge386fc4

Amitay Isaacs amitay at samba.org
Tue Mar 25 20:59:44 MDT 2014


The branch, 2.5 has been updated
       via  e386fc4e82a30dc7dd37b1a3de928bddfca871a8 (commit)
       via  ddafa969748c57e93227ae76a42d55467ccb8726 (commit)
       via  aa5a3726144c6e3ddae56ce394f5569463c32cc9 (commit)
       via  03d578211d4f9ce07bed25c02f4f74b2c05e675b (commit)
       via  a22020347f7499e3b8107d67d31ae0a70a1c8e00 (commit)
       via  f95af0ff3e75305da7c9e29c0ebd82e5fdd43ae4 (commit)
       via  5b17163543a2014d6de4af8b0f80c583d4c50cdf (commit)
       via  172ccb600d810cdb956f3a827748b073e89280ad (commit)
       via  568fde7b3eb1e234f344d832253d601864d2873d (commit)
       via  5ed83c6f18a66e35fe364ac66c474554677b2d0f (commit)
       via  a1f0b5dca579cfb3703bb5192e744c39707de2a4 (commit)
       via  e8991c8d6774eb2203449e36805bf5b26a27153f (commit)
       via  2bb78f289633922d37b69ba3665375e5c4f23a2a (commit)
       via  560d998505b5b8d00913bb7f6275f75d6b4097e1 (commit)
       via  a1ba269d97bcaf162869365235d65668edcdc85c (commit)
       via  012a7c2fd0368f162ca169636ee9cf4c2e5aee62 (commit)
       via  e1556331c842a1a3c0ef0c445c82d2bfdccc4d26 (commit)
       via  268153568ef4cbac4816c2b09df4bd4f7e17347f (commit)
       via  38de5171b7343c28effa649bda53ecf637f05c3f (commit)
       via  71ac6d1573531f0beaade625c96d6f020ae4a175 (commit)
       via  f533d1e8bf2c264c5e5e0e017228b08c7158cac8 (commit)
       via  9a921a594894ef51c44d133620c42d466806cb47 (commit)
       via  60cf52e64c1be74206d09b55f9603c9ea2cb5c33 (commit)
       via  d8cb269cea70df9900b55c7381b02d1a83f0dac2 (commit)
      from  f9fbccbbd8e98c514648ff5094e6b4c7697a1909 (commit)

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


- Log -----------------------------------------------------------------
commit e386fc4e82a30dc7dd37b1a3de928bddfca871a8
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 22 17:01:19 2014 +1100

    daemon: Optimise deletion of IPs
    
    Previous commits maintained the ordering between
    ctdb_remove_orphaned_ifaces() and ctdb_vnn_unassign_iface().  This
    meant that ctdb_remove_orphaned_ifaces() needed to steal the orphaned
    interfaces and they would be freed later.
    
    Unassign the interface first and things get simpler.
    ctdb_remove_orphaned_ifaces() is now self-contained.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Sun Mar 23 06:20:43 CET 2014 on sn-devel-104
    
    (Imported from commit 20c719677a28afa1d1b912b9fadbf384e9e65de7)

commit ddafa969748c57e93227ae76a42d55467ccb8726
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Jan 22 13:30:47 2014 +1100

    daemon: Make delete IP wait until the IP is released
    
    reloadips really expects deleted IPs to be released before completing.
    Otherwise the recovery daemon starts failing the local IP check.  The
    races that follow can cause a node to be banned.
    
    To make the error handling simple, do the actual deletion in
    release_ip_callback().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 9b907536fb657fa15c02858caf0ffff633ecd478)

commit aa5a3726144c6e3ddae56ce394f5569463c32cc9
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 28 15:54:05 2014 +1100

    tests: Improve tickle tests
    
    It is hard to diagnose failures in the NFS tickle test because there's
    no way of telling if the test node doesn't have the tickle or if it
    didn't get propagated.
    
    Factor out check_tickles() into local.bash and give it some
    parameters.
    
    Have the NFS test call it first to ensure the tickle has been
    registered.  Then use new function check_tickles_all() to ensure the
    tickle has been propagated to all nodes.  Give this a bit of extra
    time (double the timeout) just in case we're racing with the update.
    
    Add a useful comment to the CIFS test so that I stop asking myself how
    the test could ever have worked reliably.  :-)
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit bafb9151ccb5722df36f9ba168716f4f4fa01cdc)

commit 03d578211d4f9ce07bed25c02f4f74b2c05e675b
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Mar 4 15:06:11 2014 +1100

    daemon: Do not disable monitoring when running eventscripts
    
    This is racy and cbffbb7c2f406fc1d8ebad3c531cc2757232690e makes it
    unnecessary.
    
    The eventscript code still knows that monitor events are special
    compared to other events.  However, the general concept of monitoring
    is no longer tangled up with running scripts.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit ecafbce1b1cf53ae8c3de9eb5201192f7fe1f67d)

commit a22020347f7499e3b8107d67d31ae0a70a1c8e00
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 05:50:14 2014 +1100

    eventscripts: Attach to persistent ctdb.tdb in "startup" event
    
    "statd-callout notify" currently complains until an add-client or
    del-client is done.
    
    Given that we might use ctdb.tdb for something else in the future it
    makes sense attach to it in the "startup" event.  This could be done
    in the background but it should be so lightweight that a timeout will
    indicate serious problems.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 87d58fd07b1294688b8fc6dbdf3dbb6cb12d3a80)

commit f95af0ff3e75305da7c9e29c0ebd82e5fdd43ae4
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Mar 13 16:53:15 2014 +1100

    daemon: Fix tickle updates to recently started nodes
    
    Commit 0723fedcedd4a97870f7b1224945f1587363c9bf added a cheap
    implemention of ctdb_control_startup() that simply flags the recipient
    node as needing to send updates for each IP when the tickle update
    loop next fires.  Commit 026996550d726836091ff5ebd1ebf925bf237bb0
    ensures that a node only sends tickle updates once being flagged to do
    so.
    
    CTDB_CONTROL_STARTUP is broadcast to all nodes, so this is a good
    start.  However, the tickle updates are only broadcast to connected
    nodes.  A recently started node may not yet be considered to be
    connected because the keepalive monitoring loop may not yet have
    marked the node as connected.  This means that the tickle update loop
    races with the keepalive monitoring loop.  If the tickle update loop
    wins then updates will not be sent to the recently started node.
    
    The simplest improvement is to stop the tickle update from depending
    on whether a node is connected or not.  So instead of broadcasting
    tickle updates to connected nodes, they are broadcast to all nodes.
    Since no reply is expected, this should work just fine.
    
    While looking at this code, ctdb_ctrl_set_tcp_tickles() is named like
    a client function.  It isn't a client function.  Also, 2 of the
    arguments are ignored.  So rename this function to
    ctdb_send_set_tcp_tickles_for_ip() and remove the ignored arguments.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 4f79fa6c7c843502fcdaa2dead534ea3719b9f69)

commit 5b17163543a2014d6de4af8b0f80c583d4c50cdf
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 13:20:06 2014 +1100

    tools-ctdb: Parse IP addresses when reading a list from a file
    
    This way this logic is centralised.  It also means that the IP address
    comparisons in the NAT gateway code are IPv6 safe.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 441e0998370bfd7b0de5dd9aed7e2abbcf64cf73)

commit 172ccb600d810cdb956f3a827748b073e89280ad
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 16:23:42 2014 +1100

    tools-ctdb: Remove redundant filtering of trailing empty lines
    
    There is a check for empty lines in the loop just below.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit fad2b6b074495eb1dc036cce293456857985f8f5)

commit 568fde7b3eb1e234f344d832253d601864d2873d
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 13:04:25 2014 +1100

    tools-ctdb: Use DLIST_ADD_END() to avoid reversing the list
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 555aa06c41e7f77bf241e04ccf771009645e9c27)

commit 5ed83c6f18a66e35fe364ac66c474554677b2d0f
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 12:57:30 2014 +1100

    tools-ctdb: Factor out function read_pnn_node_file()
    
    Factor it from read_nodes_file().  Use it there and in
    read_natgw_nodes_file().
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 91895b33c52c0a81904c3ea36042d4574422f5fd)

commit a1f0b5dca579cfb3703bb5192e744c39707de2a4
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 17 13:42:35 2014 +1100

    tests: Add "ctdb listnodes" and "ctdb xpnn" stub tests
    
    Tests for xpnn need to implement a stub for ctdb_sys_have_ip().  The
    cheapest way of doing this is to read a fake nodemap using the
    existing code and check if the IP of the "current" node is the one
    being asked about.  However, the fake state initialisation isn't
    currently available to without_daemon commands because it is meant to
    represent daemon state.  However, it can be made available by moving
    the relevant code into a new stub for tevent_context_init().  The stub
    still needs to initialise a tevent context - this can be done by
    calling a lower level function.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 79d28000043bd463beecaeac47855d3a4970eaf2)

commit e8991c8d6774eb2203449e36805bf5b26a27153f
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 12:45:23 2014 +1100

    tools-ctdb: Read NAT gateway nodes from a separate function
    
    Now it gets easier to refactor.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 9bede494743f0ce13493fe718ed8f0c3c5f2959c)

commit 2bb78f289633922d37b69ba3665375e5c4f23a2a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 3 11:41:32 2014 +1100

    tools-ctdb: Add and use function filter_nodemap_by_natgw_nodes()
    
    Add another filter function, like the ones for capabilities and flags
    to, for filtering by NAT gateway nodes.  This makes the main
    natgw_list function more readable.
    
    Note that this drops the early filtering of disconnected nodes, so
    they will now be listed in a NAT gateway group.  This makes sense.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit ba69742ccd822562ca2135d2466e09bf1216644b)

commit 560d998505b5b8d00913bb7f6275f75d6b4097e1
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 19 18:45:18 2014 +1100

    tools-ctdb: Update LVS commands to use filter_nodemap_by_flags()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit e728a35dc19c397cb17e1bf434401df25c35f337)

commit a1ba269d97bcaf162869365235d65668edcdc85c
Author: Martin Schwenke <martin at meltin.net>
Date:   Wed Feb 19 17:12:08 2014 +1100

    tools-ctdb: Update LVS commands to use filter_nodemap_by_capabilities()
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 26c9a591e539e33dd0896ec1e2958192b3e4efd4)

commit 012a7c2fd0368f162ca169636ee9cf4c2e5aee62
Author: Martin Schwenke <martin at meltin.net>
Date:   Fri Feb 28 20:16:34 2014 +1100

    tools-ctdb: Fixes for "lvs" and "lvsmaster" commands
    
    The index of the nodes array in nodemap isn't the PNN.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 5fb7e386ac4452786512d077a00b4907ef39cb51)

commit e1556331c842a1a3c0ef0c445c82d2bfdccc4d26
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 17:11:53 2014 +1100

    tools-ctdb: Generalise find_natgw() -> filter_nodemap_by_flags()
    
    Instead of just finding the first node that doesn't have any flags in
    flag_mask set, change it into a function that filters a nodemap to
    exclude nodes with the given flags.
    
    This makes the NATGW code simpler but also provides a function that
    can be used in other code.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 33b1fcbd7083668cfd58b1cfb1172b6134cd07ca)

commit 268153568ef4cbac4816c2b09df4bd4f7e17347f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 15:52:37 2014 +1100

    tools-ctdb: Update natgwlist to filter nodes by NATGW capability
    
    Check capabilities once to build a filtered node list instead of
    repeatedly checking capabilities
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 798bd58370f6ea7bc70db96edd23ae86caf6bf79)

commit 38de5171b7343c28effa649bda53ecf637f05c3f
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 12:29:44 2014 +1100

    tests: New natgwlist tests where nodes capability not set
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 771005386403acf15a81be5de2a3798384a37d8a)

commit 71ac6d1573531f0beaade625c96d6f020ae4a175
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 12:12:06 2014 +1100

    tests: Update ctdb stub LVS tests and add some new ones
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 75cf99b9da1677fa83197d111d757e14041dae05)

commit f533d1e8bf2c264c5e5e0e017228b08c7158cac8
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 11:34:11 2014 +1100

    tests: Support fake capabilities in CTDB tool stub
    
    ... and add a test to make sure it works.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 3af858e6f4990599c23b54d05c42187400fd1426)

commit 9a921a594894ef51c44d133620c42d466806cb47
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Feb 18 11:02:49 2014 +1100

    tests: Remove old, unused copy of a CTDB tool unit test
    
    This looks to have got left behind a long time ago when things got
    moved around...
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit 263e5eabf8d55c7f53db597b8fcede831c211e45)

commit 60cf52e64c1be74206d09b55f9603c9ea2cb5c33
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Mar 17 13:28:14 2014 +1100

    tools-ctdb: Don't close stderr when running without_daemon commands
    
    It looks like the original without_daemon code still tried to
    establish a client connection to the daemon.  Closing stderr looks to
    be a cheap way of hiding the errors when this failed.
    
    However, later cleanups avoid the client connection altogether, so do
    not close stderr.  Now debug output from without_daemon commands
    actually appears.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    (Imported from commit a947cf6c0c3e1453ec833033dcd2edaa9490a55b)

commit d8cb269cea70df9900b55c7381b02d1a83f0dac2
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Mar 20 14:23:01 2014 +0100

    pmda: Fix metric identifiers
    
    The commit "pmda: Use upstream assigned PCP domain id" updated the
    Performance Metrics Namespace (pmns) file, without changing the
    corresponding metric identifiers used by the agent.
    
    This change fixes the agent metric identifier values to match the pmns
    definitions.
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Sat Mar 22 00:07:31 CET 2014 on sn-devel-104
    
    (Imported from commit 7fdb21cc321bc0b9a759393467fe42f26cdc812a)

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

Summary of changes:
 config/events.d/00.ctdb                            |    3 +-
 include/ctdb_private.h                             |    9 +-
 server/ctdb_control.c                              |    3 +-
 server/ctdb_takeover.c                             |  150 ++++--
 server/eventscript.c                               |    5 -
 tests/complex/31_nfs_tickle.sh                     |   24 +-
 tests/complex/32_cifs_tickle.sh                    |   12 +-
 tests/complex/scripts/local.bash                   |   29 ++
 tests/src/ctdb_test.c                              |    8 +
 tests/src/ctdb_test_stubs.c                        |   60 +++-
 tests/tool/scripts/local.sh                        |   11 +
 tests/tool/stubby.getcapabilities.004.sh           |   57 +++
 tests/tool/stubby.listnodes.001.sh                 |   20 +
 tests/tool/stubby.listnodes.002.sh                 |   20 +
 tests/tool/stubby.lvs.001.sh                       |    3 +-
 tests/tool/stubby.lvs.002.sh                       |   29 ++
 ...by.getcapabilities.001.sh => stubby.lvs.003.sh} |   12 +-
 tests/tool/stubby.lvsmaster.001.sh                 |    3 +-
 tests/tool/stubby.lvsmaster.002.sh                 |    1 -
 tests/tool/stubby.lvsmaster.003.sh                 |   27 ++
 tests/tool/stubby.lvsmaster.004.sh                 |   27 ++
 tests/tool/stubby.lvsmaster.005.sh                 |   27 ++
 tests/tool/stubby.lvsmaster.006.sh                 |   27 ++
 tests/tool/stubby.lvsmaster.007.sh                 |   27 ++
 ...by.natgwlist.005.sh => stubby.natgwlist.006.sh} |    8 +-
 ...by.natgwlist.005.sh => stubby.natgwlist.007.sh} |   12 +-
 tests/tool/stubby.xpnn.001.sh                      |   20 +
 tests/tool/stubby.xpnn.002.sh                      |   20 +
 tests/tool/stubby.xpnn.003.sh                      |   24 +
 tests/tool/testcases/stubby.nodestatus.005.sh      |   34 --
 tools/ctdb.c                                       |  493 ++++++++++----------
 utils/pmda/pmda_ctdb.c                             |  264 ++++++-----
 32 files changed, 962 insertions(+), 507 deletions(-)
 create mode 100755 tests/tool/stubby.getcapabilities.004.sh
 create mode 100755 tests/tool/stubby.listnodes.001.sh
 create mode 100755 tests/tool/stubby.listnodes.002.sh
 create mode 100755 tests/tool/stubby.lvs.002.sh
 copy tests/tool/{stubby.getcapabilities.001.sh => stubby.lvs.003.sh} (54%)
 create mode 100755 tests/tool/stubby.lvsmaster.003.sh
 create mode 100755 tests/tool/stubby.lvsmaster.004.sh
 create mode 100755 tests/tool/stubby.lvsmaster.005.sh
 create mode 100755 tests/tool/stubby.lvsmaster.006.sh
 create mode 100755 tests/tool/stubby.lvsmaster.007.sh
 copy tests/tool/{stubby.natgwlist.005.sh => stubby.natgwlist.006.sh} (70%)
 copy tests/tool/{stubby.natgwlist.005.sh => stubby.natgwlist.007.sh} (59%)
 create mode 100755 tests/tool/stubby.xpnn.001.sh
 create mode 100755 tests/tool/stubby.xpnn.002.sh
 create mode 100755 tests/tool/stubby.xpnn.003.sh
 delete mode 100755 tests/tool/testcases/stubby.nodestatus.005.sh


Changeset truncated at 500 lines:

diff --git a/config/events.d/00.ctdb b/config/events.d/00.ctdb
index 719bee8..a0f4102 100755
--- a/config/events.d/00.ctdb
+++ b/config/events.d/00.ctdb
@@ -196,12 +196,13 @@ case "$1" in
 	fi
 	;;
 
-     setup)
+    setup)
 	# Set any tunables from the config file
 	set_ctdb_variables || die "Failed to set CTDB tunables"
 	;;
 
     startup)
+	ctdb attach ctdb.tdb persistent
 	update_config_from_tdb &
 	;;
     monitor)
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index b95b2c7..8ed867d 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -212,6 +212,11 @@ struct ctdb_vnn {
 	/* Set to true any time an update to this VNN is in flight.
 	   This helps to avoid races. */
 	bool update_in_flight;
+
+	/* If CTDB_CONTROL_DEL_PUBLIC_IP is received for this IP
+	 * address then this flag is set.  It will be deleted in the
+	 * release IP callback. */
+	bool delete_pending;
 };
 
 /*
@@ -1264,7 +1269,9 @@ int32_t ctdb_control_list_tunables(struct ctdb_context *ctdb, TDB_DATA *outdata)
 int32_t ctdb_control_try_delete_records(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata);
 int32_t ctdb_control_receive_records(struct ctdb_context *ctdb, TDB_DATA indata, TDB_DATA *outdata);
 int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA indata);
-int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb, TDB_DATA indata);
+int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb,
+					struct ctdb_req_control *c,
+					TDB_DATA recdata, bool *async_reply);
 
 void ctdb_tunables_set_defaults(struct ctdb_context *ctdb);
 
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index 581c478..b407a1f 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -481,7 +481,8 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
 		return ctdb_control_add_public_address(ctdb, indata);
 
 	case CTDB_CONTROL_DEL_PUBLIC_IP:
-		return ctdb_control_del_public_address(ctdb, indata);
+		return ctdb_control_del_public_address(ctdb, c, indata,
+						       async_reply);
 
 	case CTDB_CONTROL_GET_CAPABILITIES:
 		return ctdb_control_get_capabilities(ctdb, outdata);
diff --git a/server/ctdb_takeover.c b/server/ctdb_takeover.c
index 5c8eb05..34afea5 100644
--- a/server/ctdb_takeover.c
+++ b/server/ctdb_takeover.c
@@ -118,19 +118,20 @@ static bool vnn_has_interface_with_name(struct ctdb_vnn *vnn,
  * causes problems...  :-)
  */
 static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
-					struct ctdb_vnn *vnn,
-					TALLOC_CTX *mem_ctx)
+					struct ctdb_vnn *vnn)
 {
 	struct ctdb_iface *i;
 
 	/* For each interface, check if there's an IP using it. */
-	for(i=ctdb->ifaces; i; i=i->next) {
+	i = ctdb->ifaces;
+	while (i != NULL) {
 		struct ctdb_vnn *tv;
 		bool found;
+		struct ctdb_iface *next = i->next;
 
 		/* Only consider interfaces named in the given VNN. */
 		if (!vnn_has_interface_with_name(vnn, i->name)) {
-			continue;
+			goto next;
 		}
 
 		/* Is the "single IP" on this interface? */
@@ -138,7 +139,7 @@ static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
 		    (ctdb->single_ip_vnn->ifaces[0] != NULL) &&
 		    (strcmp(i->name, ctdb->single_ip_vnn->ifaces[0]) == 0)) {
 			/* Found, next interface please... */
-			continue;
+			goto next;
 		}
 		/* Search for a vnn with this interface. */
 		found = false;
@@ -152,9 +153,11 @@ static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
 		if (!found) {
 			/* None of the VNNs are using this interface. */
 			DLIST_REMOVE(ctdb->ifaces, i);
-			/* Caller will free mem_ctx when convenient. */
-			talloc_steal(mem_ctx, i);
+			talloc_free(i);
 		}
+
+	next:
+		i = next;
 	}
 }
 
@@ -260,6 +263,10 @@ static bool ctdb_vnn_available(struct ctdb_context *ctdb,
 {
 	int i;
 
+	if (vnn->delete_pending) {
+		return false;
+	}
+
 	if (vnn->iface && vnn->iface->link_up) {
 		return true;
 	}
@@ -865,6 +872,14 @@ static void release_kill_clients(struct ctdb_context *ctdb, ctdb_sock_addr *addr
 	}
 }
 
+static void do_delete_ip(struct ctdb_context *ctdb, struct ctdb_vnn *vnn)
+{
+	DLIST_REMOVE(ctdb->vnn, vnn);
+	ctdb_vnn_unassign_iface(ctdb, vnn);
+	ctdb_remove_orphaned_ifaces(ctdb, vnn);
+	talloc_free(vnn);
+}
+
 /*
   called when releaseip event finishes
  */
@@ -903,6 +918,12 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
 
 	ctdb_vnn_unassign_iface(ctdb, state->vnn);
 
+	/* Process the IP if it has been marked for deletion */
+	if (state->vnn->delete_pending) {
+		do_delete_ip(ctdb, state->vnn);
+		state->vnn = NULL;
+	}
+
 	/* the control succeeded */
 	ctdb_request_control_reply(ctdb, state->c, NULL, 0, NULL);
 	talloc_free(state);
@@ -910,7 +931,9 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
 
 static int ctdb_releaseip_destructor(struct takeover_callback_state *state)
 {
-	state->vnn->update_in_flight = false;
+	if (state->vnn != NULL) {
+		state->vnn->update_in_flight = false;
+	}
 	return 0;
 }
 
@@ -3958,10 +3981,9 @@ int32_t ctdb_control_get_tcp_tickle_list(struct ctdb_context *ctdb, TDB_DATA ind
 /*
   set the list of all tcp tickles for a public address
  */
-static int ctdb_ctrl_set_tcp_tickles(struct ctdb_context *ctdb, 
-			      struct timeval timeout, uint32_t destnode, 
-			      ctdb_sock_addr *addr,
-			      struct ctdb_tcp_array *tcparray)
+static int ctdb_send_set_tcp_tickles_for_ip(struct ctdb_context *ctdb,
+					    ctdb_sock_addr *addr,
+					    struct ctdb_tcp_array *tcparray)
 {
 	int ret, num;
 	TDB_DATA data;
@@ -3986,7 +4008,7 @@ static int ctdb_ctrl_set_tcp_tickles(struct ctdb_context *ctdb,
 		memcpy(&list->tickles.connections[0], tcparray->connections, sizeof(struct ctdb_tcp_connection) * num);
 	}
 
-	ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0, 
+	ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0,
 				       CTDB_CONTROL_SET_TCP_TICKLE_LIST,
 				       0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
 	if (ret != 0) {
@@ -4022,11 +4044,9 @@ static void ctdb_update_tcp_tickles(struct event_context *ev,
 		if (!vnn->tcp_update_needed) {
 			continue;
 		}
-		ret = ctdb_ctrl_set_tcp_tickles(ctdb, 
-				TAKEOVER_TIMEOUT(),
-				CTDB_BROADCAST_CONNECTED,
-				&vnn->public_address,
-				vnn->tcp_array);
+		ret = ctdb_send_set_tcp_tickles_for_ip(ctdb,
+						       &vnn->public_address,
+						       vnn->tcp_array);
 		if (ret != 0) {
 			DEBUG(DEBUG_ERR,("Failed to send the tickle update for public address %s\n",
 				ctdb_addr_to_str(&vnn->public_address)));
@@ -4167,20 +4187,32 @@ int32_t ctdb_control_add_public_address(struct ctdb_context *ctdb, TDB_DATA inda
 	return 0;
 }
 
+struct delete_ip_callback_state {
+	struct ctdb_req_control *c;
+};
+
 /*
   called when releaseip event finishes for del_public_address
  */
-static void delete_ip_callback(struct ctdb_context *ctdb, int status, 
-				void *private_data)
+static void delete_ip_callback(struct ctdb_context *ctdb,
+			       int32_t status, TDB_DATA data,
+			       const char *errormsg,
+			       void *private_data)
 {
+	struct delete_ip_callback_state *state =
+		talloc_get_type(private_data, struct delete_ip_callback_state);
+
+	/* If release failed then fail. */
+	ctdb_request_control_reply(ctdb, state->c, NULL, status, errormsg);
 	talloc_free(private_data);
 }
 
-int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb, TDB_DATA indata)
+int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb,
+					struct ctdb_req_control *c,
+					TDB_DATA indata, bool *async_reply)
 {
 	struct ctdb_control_ip_iface *pub = (struct ctdb_control_ip_iface *)indata.dptr;
 	struct ctdb_vnn *vnn;
-	int ret;
 
 	/* verify the size of indata */
 	if (indata.dsize < offsetof(struct ctdb_control_ip_iface, iface)) {
@@ -4203,37 +4235,63 @@ int32_t ctdb_control_del_public_address(struct ctdb_context *ctdb, TDB_DATA inda
 	/* walk over all public addresses until we find a match */
 	for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
 		if (ctdb_same_ip(&vnn->public_address, &pub->addr)) {
-			TALLOC_CTX *mem_ctx = talloc_new(ctdb);
-
-			DLIST_REMOVE(ctdb->vnn, vnn);
-			talloc_steal(mem_ctx, vnn);
-			ctdb_remove_orphaned_ifaces(ctdb, vnn, mem_ctx);
-			if (vnn->pnn != ctdb->pnn) {
-				if (vnn->iface != NULL) {
-					ctdb_vnn_unassign_iface(ctdb, vnn);
+			if (vnn->pnn == ctdb->pnn) {
+				struct delete_ip_callback_state *state;
+				struct ctdb_public_ip *ip;
+				TDB_DATA data;
+				int ret;
+
+				vnn->delete_pending = true;
+
+				state = talloc(ctdb,
+					       struct delete_ip_callback_state);
+				CTDB_NO_MEMORY(ctdb, state);
+				state->c = c;
+
+				ip = talloc(state, struct ctdb_public_ip);
+				if (ip == NULL) {
+					DEBUG(DEBUG_ERR,
+					      (__location__ " Out of memory\n"));
+					talloc_free(state);
+					return -1;
+				}
+				ip->pnn = -1;
+				ip->addr = pub->addr;
+
+				data.dsize = sizeof(struct ctdb_public_ip);
+				data.dptr = (unsigned char *)ip;
+
+				ret = ctdb_daemon_send_control(ctdb,
+							       ctdb_get_pnn(ctdb),
+							       0,
+							       CTDB_CONTROL_RELEASE_IP,
+							       0, 0,
+							       data,
+							       delete_ip_callback,
+							       state);
+				if (ret == -1) {
+					DEBUG(DEBUG_ERR,
+					      (__location__ "Unable to send "
+					       "CTDB_CONTROL_RELEASE_IP\n"));
+					talloc_free(state);
+					return -1;
 				}
-				talloc_free(mem_ctx);
-				return 0;
-			}
-			vnn->pnn = -1;
 
-			ret = ctdb_event_script_callback(ctdb, 
-					 mem_ctx, delete_ip_callback, mem_ctx,
-					 CTDB_EVENT_RELEASE_IP,
-					 "%s %s %u",
-					 ctdb_vnn_iface_string(vnn),
-					 ctdb_addr_to_str(&vnn->public_address),
-					 vnn->public_netmask_bits);
-			if (vnn->iface != NULL) {
-				ctdb_vnn_unassign_iface(ctdb, vnn);
-			}
-			if (ret != 0) {
-				return -1;
+				state->c = talloc_steal(state, c);
+				*async_reply = true;
+			} else {
+				/* This IP is not hosted on the
+				 * current node so just delete it
+				 * now. */
+				do_delete_ip(ctdb, vnn);
 			}
+
 			return 0;
 		}
 	}
 
+	DEBUG(DEBUG_ERR,("Delete IP of unknown public IP address %s\n",
+			 ctdb_addr_to_str(&pub->addr)));
 	return -1;
 }
 
diff --git a/server/eventscript.c b/server/eventscript.c
index ed20124..bf95b21 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -901,8 +901,6 @@ static void run_eventscripts_callback(struct ctdb_context *ctdb, int status,
 	struct eventscript_callback_state *state = 
 		talloc_get_type(private_data, struct eventscript_callback_state);
 
-	ctdb_enable_monitoring(ctdb);
-
 	if (status != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to run eventscripts\n"));
 	}
@@ -966,14 +964,11 @@ int32_t ctdb_run_eventscripts(struct ctdb_context *ctdb,
 
 	DEBUG(DEBUG_NOTICE,("Running eventscripts with arguments %s\n", indata.dptr));
 
-	ctdb_disable_monitoring(ctdb);
-
 	ret = ctdb_event_script_callback(ctdb, 
 			 state, run_eventscripts_callback, state,
 			 call, "%s", options);
 
 	if (ret != 0) {
-		ctdb_enable_monitoring(ctdb);
 		DEBUG(DEBUG_ERR,(__location__ " Failed to run eventscripts with arguments %s\n", indata.dptr));
 		talloc_free(state);
 		return -1;
diff --git a/tests/complex/31_nfs_tickle.sh b/tests/complex/31_nfs_tickle.sh
index b5ed47e..5aeb870 100755
--- a/tests/complex/31_nfs_tickle.sh
+++ b/tests/complex/31_nfs_tickle.sh
@@ -34,8 +34,8 @@ Steps:
 
 Expected results:
 
-* CTDB should correctly record the socket in the nfs-tickles directory
-  and should send a reset packet when the node is disabled.
+* CTDB should correctly record the socket and should send a reset
+  packet when the node is disabled.
 EOF
 }
 
@@ -58,6 +58,8 @@ monitor_interval="${out#*= }"
 #echo "Monitor interval on node $test_node is $monitor_interval seconds."
 
 select_test_node_and_ips
+try_command_on_node $test_node "$CTDB listnodes | wc -l"
+numnodes="$out"
 
 test_port=2049
 
@@ -73,18 +75,16 @@ echo "Source socket is $src_socket"
 
 wait_for_monitor_event $test_node
 
-echo "Sleeping until tickles are synchronised across nodes..."
-try_command_on_node $test_node $CTDB getvar TickleUpdateInterval
-sleep_for "${out#*= }"
+echo "Wait until NFS connection is tracked by CTDB on test node ..."
+wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
 
-try_command_on_node -v any "ctdb -Y gettickles $test_ip $test_port"
+echo "Getting TicklesUpdateInterval..."
+try_command_on_node $test_node $CTDB getvar TickleUpdateInterval
+update_interval="$out"
 
-if [ "${out/${src_socket}/}" != "$out" ] ; then
-    echo "GOOD: NFS connection tracked OK."
-else
-    echo "BAD: Socket not tracked in NFS tickles."
-    testfailures=1
-fi
+echo "Wait until NFS connection is tracked by CTDB on all nodes..."
+wait_until $(($update_interval * 2)) \
+    check_tickles_all $numnodes  $test_ip $test_port $src_socket
 
 tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
 
diff --git a/tests/complex/32_cifs_tickle.sh b/tests/complex/32_cifs_tickle.sh
index 93634e7..70ce93f 100755
--- a/tests/complex/32_cifs_tickle.sh
+++ b/tests/complex/32_cifs_tickle.sh
@@ -72,15 +72,8 @@ echo "Source socket is $src_socket"
 
 # This should happen as soon as connection is up... but unless we wait
 # we sometimes beat the registration.
-check_tickles ()
-{
-    try_command_on_node 0 ctdb gettickles $test_ip -n $test_node
-    # SRC: 10.0.2.45:49091   DST: 10.0.2.143:445
-    [ "${out/SRC: ${src_socket} /}" != "$out" ]
-}
-
 echo "Checking if CIFS connection is tracked by CTDB..."
-wait_until 10 check_tickles
+wait_until 10 check_tickles $test_node $test_ip $test_port $src_socket
 echo "$out"
 
 if [ "${out/SRC: ${src_socket} /}" != "$out" ] ; then
@@ -92,6 +85,9 @@ fi
 
 tcptickle_sniff_start $src_socket "${test_ip}:${test_port}"
 
+# The test node is only being disabled so the tickling is done from
+# the test node.  We don't need to wait until the tickles are
+# transferred to another node.
 echo "Disabling node $test_node"
 try_command_on_node 1 $CTDB disable -n $test_node
 wait_until_node_has_status $test_node disabled
diff --git a/tests/complex/scripts/local.bash b/tests/complex/scripts/local.bash
index eb4c41c..6fbc1ae 100644
--- a/tests/complex/scripts/local.bash
+++ b/tests/complex/scripts/local.bash
@@ -29,6 +29,35 @@ wait_until_get_src_socket ()
 
 #######################################
 
+check_tickles ()
+{
+    local node="$1"
+    local test_ip="$2"
+    local test_port="$3"
+    local src_socket="$4"
+    try_command_on_node $node ctdb gettickles $test_ip $test_port
+    # SRC: 10.0.2.45:49091   DST: 10.0.2.143:445
+    [ "${out/SRC: ${src_socket} /}" != "$out" ]
+}
+
+check_tickles_all ()
+{
+    local numnodes="$1"
+    local test_ip="$2"
+    local test_port="$3"
+    local src_socket="$4"
+
+    try_command_on_node all ctdb gettickles $test_ip $test_port
+    # SRC: 10.0.2.45:49091   DST: 10.0.2.143:445
+    local t="${src_socket//./\\.}"
+    local count=$(grep -E -c "SRC: ${t} " <<<"$out" || true)
+    [ $count -eq $numnodes ]
+}
+
+
+
+#######################################
+
 # filename will be in $tcpdump_filename, pid in $tcpdump_pid
 tcpdump_start ()
 {
diff --git a/tests/src/ctdb_test.c b/tests/src/ctdb_test.c
index bbb51bd..68a8282 100644
--- a/tests/src/ctdb_test.c
+++ b/tests/src/ctdb_test.c
@@ -30,6 +30,8 @@
 
 #define ctdb_cmdline_client(x, y) \
 	ctdb_cmdline_client_stub(x, y)
+#define tevent_context_init(x) \
+	tevent_context_init_stub(x)
 #define ctdb_ctrl_getnodemap(ctdb, timelimit, pnn, tmp_ctx, nodemap) \
 	ctdb_ctrl_getnodemap_stub(ctdb, timelimit, pnn, tmp_ctx, nodemap)
 #define ctdb_ctrl_get_ifaces(ctdb, timelimit, pnn, tmp_ctx, ifaces) \
@@ -48,6 +50,8 @@
 	ctdb_client_check_message_handlers_stub(ctdb, ids, argc, result)
 #define ctdb_ctrl_getcapabilities(ctdb, timeout, destnode, capabilities) \
 	ctdb_ctrl_getcapabilities_stub(ctdb, timeout, destnode, capabilities)
+#define ctdb_sys_have_ip(addr) \
+	ctdb_sys_have_ip_stub(addr)
 
 #include "tools/ctdb.c"
 
@@ -57,6 +61,9 @@
 #endif /* CTDB_TEST_USE_MAIN */
 


-- 
CTDB repository


More information about the samba-cvs mailing list