[SCM] CTDB repository - branch master updated -
4edc6d40cb63936146af99030b7819683238abfc
Andrew Tridgell
tridge at samba.org
Fri Jul 4 06:05:25 GMT 2008
The branch, master has been updated
via 4edc6d40cb63936146af99030b7819683238abfc (commit)
via af1f6cf7561fe9cb5c97f940d4458c83bdd8e2a0 (commit)
via f86551580349b7f662f9a07e4eb0c1189e38e429 (commit)
via 423934629704683d3a3042570577fb4e04b17a6d (commit)
via e4c9e511fc5e15e0638ebb9117cb4a65ca8fda4b (commit)
via af5d9435822917d36929e667063db69e6a426d3d (commit)
via 9f501cee9132114e7467a33dab5cfe0737f94f44 (commit)
via 9b8179ad043a80e0e18eeba427a7b7b15690d039 (commit)
via 4f2d722cf29175c3c207e6ebb6d4f9e370767249 (commit)
via a928857e38d645baca62cea7f7367488d140dca7 (commit)
via f71287a28d66db202fe52f9a43b6daf2389d7f66 (commit)
via 9a98a21979558dcd6421b3fcb97d21ab82b792d8 (commit)
via 251aeadc8b16a9c27a4bae78c97ad6e93e6cfdf4 (commit)
via d481f0f3d11e66d259cbc84f34cb6ae27d09e42c (commit)
via b8c8c5cb351747863c5d1366b57c96122ade5db0 (commit)
via 3387597926ad71e4140cc504b828486d99a3ec8e (commit)
via b99d687894cb69d863345713055d9c8dc1b29194 (commit)
via f15b224e42e81cda84b98f01f919d463e80fb89f (commit)
via 8734bd32809ad817ad28d96315a139674429c395 (commit)
via de8f1bedc56da05c03cfd0e4780839771d94a58f (commit)
via b4e6d8e37c7f985f357af82b4a524959bb97ec4c (commit)
via 7239d7ecd54037b11eddf47328a3129d281e7d4a (commit)
via dbe31581abf35fc4a32d3cbf487dd34e2b9c937a (commit)
via 3a69fad0b1dee4a482461680c556358409e53c4d (commit)
via 72f89bac13cbe8c3ca3e7a942469cd2ff25abba2 (commit)
via 5444ebd0815e335a75ef4857546e23f490a22338 (commit)
via b87fab857bc9b3537527be93b7f68484502d6b84 (commit)
via 86d6f53512d358ff68b58dac737ffa7576c3cce6 (commit)
via 4948574f5a290434f3edd0c052cf13f3645deec4 (commit)
via 181318fea6886c40d0aff02d0de777f28ffeddce (commit)
via 00006222ece63ae3b7f3477646232ae5bbeee6f4 (commit)
via dfe0c44c1e8e9dab790686c5ba798986d04bf218 (commit)
via f0b55adae450cac3cf925e111e1dc9628cff4525 (commit)
via 30523c443777452cbca4a6924fd33c3f4caac5b6 (commit)
via 1d7c3eb454e33cd17c74606c4ea011fd79959c80 (commit)
via 70085523f4c35a20786023c489325554e2a6f9c1 (commit)
via a53db1ec3f29f4418ff51e0f452026c12470bf93 (commit)
via 2da3d1f876f5d654f849af8a3e588f5a61300c3d (commit)
via 9e1adfdd4cc606f4134fdeba8d3539e29e7e5056 (commit)
via fb9870916ce0798695b09d33208a19d5de1cfd29 (commit)
via e07abdfbdb7963309898f0bf5382b8e951409f0a (commit)
via 437752d002a108bcbbf6dc8bfb5dbf16dc5f1c58 (commit)
via 6f6de0becd179be9eb9a6bf70562b090205ce196 (commit)
via 3d85d2cf669686f89cacdc481eaa97aef1ba62c0 (commit)
via 7fb6cf549de1b5e9ac5a3e4483c7591850ea2464 (commit)
via 2908e092710d7fa2245161b3315747e17e4226c0 (commit)
via 92be23dbd6a5bf32d4d1af4a41437fbcd7d8eaf2 (commit)
via a953a0fb450955b62d747bdc82c5b968fe0ed378 (commit)
via 1ad0295f86370979d0537f7290f5e9c7d1ff6e94 (commit)
from c8181476748395fe6ec5284c49e9d37b882d15ea (commit)
http://gitweb.samba.org/?p=tridge/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 4edc6d40cb63936146af99030b7819683238abfc
Author: Andrew Tridgell <tridge at samba.org>
Date: Fri Jul 4 16:05:04 2008 +1000
zero out the ctdb->freeze_handle when we free it
This prevents heap corruption when a freeze child dies
commit af1f6cf7561fe9cb5c97f940d4458c83bdd8e2a0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jul 3 12:46:09 2008 +1000
we dont need to explicitely thaw the databases from the recovery daemon
since this is already done implicitely when we changed recovery mode
back to normal
commit f86551580349b7f662f9a07e4eb0c1189e38e429
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jul 2 13:55:59 2008 +1000
track both when we last started and ended a recovery.
make ctdb uptime print how long the recovery took
in the recovery daemon when we check that the public ip address
allocation on the local node is correct (we have the ips we should have
and we dont have any we shouldnt have) use ctdb uptime and check the
recovery start/stop times and make sure we dont check for ip allocation
inconsistencies during a recovery where the ip address allocation is in flux.
commit 423934629704683d3a3042570577fb4e04b17a6d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jul 2 12:21:53 2008 +1000
print the opcode when an async callback detects an error
commit e4c9e511fc5e15e0638ebb9117cb4a65ca8fda4b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jul 2 12:01:19 2008 +1000
update a comment to reflect that this is not always a real recovery
it can also be printed when we just do an ip reallocation
commit af5d9435822917d36929e667063db69e6a426d3d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jul 1 09:34:43 2008 +1000
new version
commit 9f501cee9132114e7467a33dab5cfe0737f94f44
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 27 09:31:18 2008 +1000
initdit/ctdb is not a config file
commit 9b8179ad043a80e0e18eeba427a7b7b15690d039
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 27 09:29:38 2008 +1000
make /etc/ctdb/functions executable and add a hashbang to it so
rpmlint wont complain
commit 4f2d722cf29175c3c207e6ebb6d4f9e370767249
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 14:14:37 2008 +1000
test
commit a928857e38d645baca62cea7f7367488d140dca7
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 14:00:36 2008 +1000
Revert "test"
This reverts commit f71287a28d66db202fe52f9a43b6daf2389d7f66.
commit f71287a28d66db202fe52f9a43b6daf2389d7f66
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 13:51:18 2008 +1000
test
commit 9a98a21979558dcd6421b3fcb97d21ab82b792d8
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 13:15:41 2008 +1000
reduce loglevel of the info message we are updating the flags on all nodes
commit 251aeadc8b16a9c27a4bae78c97ad6e93e6cfdf4
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 13:08:37 2008 +1000
force an update of the flags from the recmaster after each monitoring run
commit d481f0f3d11e66d259cbc84f34cb6ae27d09e42c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 12:43:30 2008 +1000
/etc/ctdb/functions should not be executable
commit b8c8c5cb351747863c5d1366b57c96122ade5db0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 11:52:26 2008 +1000
third attempt for fixing a freeze child writing to the socket
commit 3387597926ad71e4140cc504b828486d99a3ec8e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 11:08:09 2008 +1000
verify that the recmaster has the correct flags for us and if not tell the recmaster what the flags should be
commit b99d687894cb69d863345713055d9c8dc1b29194
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 11:02:08 2008 +1000
only loop over the write it the write failed
commit f15b224e42e81cda84b98f01f919d463e80fb89f
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 26 09:54:27 2008 +1000
the write() from the freeze child process can fail
try writing many times and log an error if the write failed
commit 8734bd32809ad817ad28d96315a139674429c395
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 13:53:05 2008 +1000
it is 2008 not 2008 right now :-)
commit de8f1bedc56da05c03cfd0e4780839771d94a58f
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 13:50:28 2008 +1000
update to 1.0.42
commit b4e6d8e37c7f985f357af82b4a524959bb97ec4c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 13:45:23 2008 +1000
ban the node after 3 failed scripts by default
commit 7239d7ecd54037b11eddf47328a3129d281e7d4a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 13:18:06 2008 +1000
if the event scripts hangs EventScriptsBanCount consecutive times in a row
the node will ban itself for the default recovery ban period
commit dbe31581abf35fc4a32d3cbf487dd34e2b9c937a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 12:18:00 2008 +1000
when a eventscript has timed out, log the event options (i.e. "monitor" "takeip 1.2..." etc)
to the log
commit 3a69fad0b1dee4a482461680c556358409e53c4d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Fri Jun 13 11:47:42 2008 +1000
make it possible to re-start a recovery without marking the current node as
the culprit.
commit 72f89bac13cbe8c3ca3e7a942469cd2ff25abba2
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu Jun 12 16:53:36 2008 +1000
add a callback for failed nodes to the async control helper.
this callback is called for every node where the control failed (or timed out)
when we issue the start recovery control from recovery master,
set any node that fails as a culprit so it will eventually be banned
commit 5444ebd0815e335a75ef4857546e23f490a22338
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 4 17:12:57 2008 +1000
first cut to convert takeover_callback_state{}
to use ctdb_sock_addr instead of sockaddr_in
commit b87fab857bc9b3537527be93b7f68484502d6b84
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 4 15:23:06 2008 +1000
fix a comment
note that we dont actually send the ipv6 "gratious arp" on the wire just yet.
(since ipv6 doesnt use arp)
but all the infrastructure is there when we implement sending raw neig.disc. packets
commit 86d6f53512d358ff68b58dac737ffa7576c3cce6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 4 15:13:00 2008 +1000
convert handling of gratious arps and their controls and helpers to
use the ctdb_sock_addr structure so tehy work for both ipv4 and ipv6
commit 4948574f5a290434f3edd0c052cf13f3645deec4
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Jun 4 10:46:20 2008 +1000
add a parameter for the tdb-flags to the client function
ctdb_attach() so that we can pass TDB_NOSYNC when we attach to
a persistent database and want fast unsafe writes instead of
slow but safe tdb_transaction writes.
enhance the ctdb_persistent test suite to test both safe and unsafe writes
commit 181318fea6886c40d0aff02d0de777f28ffeddce
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 3 18:19:48 2008 +1000
run the persistent write test with 4 nodes by default
use the timelimit argument to the persistent writer to run the test for
30 seconds by default
commit 00006222ece63ae3b7f3477646232ae5bbeee6f4
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 3 18:18:28 2008 +1000
redesign the test of persistent writes
so that we have n persistent writers on n nodes,
all writers writing persistently to the same record.
each writer on a node has its own "counter" in this record that is incremented by one in each iteration.
the persistent writer on node 0 also checks that all the counters in the record are increasing monotonically and if they are not, flagging it as an ERROR.
commit dfe0c44c1e8e9dab790686c5ba798986d04bf218
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue Jun 3 18:14:54 2008 +1000
create the nodes file in a 'test' subdirectory and not the current directory
delete all persistent databases when the test starts
(the tests only uses test databases in a special test directory)
do not set up any public addresses in the tests
wait until there are no disconnected or unhealthy nodes when starting the
test daemons instead of waiting for the recovery mode to change.
we do want to wait until the system has recovered and ALL nodes are ok.
commit f0b55adae450cac3cf925e111e1dc9628cff4525
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 29 08:19:35 2008 +1000
debugleves can now be negative so print their value using %d instead of %u
commit 30523c443777452cbca4a6924fd33c3f4caac5b6
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed May 28 14:51:46 2008 +1000
update to .41
commit 1d7c3eb454e33cd17c74606c4ea011fd79959c80
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed May 28 13:40:12 2008 +1000
dont bother casting to a void* private_data pointer,
just pass it as 'state' structure
commit 70085523f4c35a20786023c489325554e2a6f9c1
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed May 28 13:31:58 2008 +1000
remove another field we dont need in the childwrite_handle structure
commit a53db1ec3f29f4418ff51e0f452026c12470bf93
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed May 28 13:30:22 2008 +1000
remote a comment that is no longer relevant
remove a field in the childwrite_handle structure we dont need
commit 2da3d1f876f5d654f849af8a3e588f5a61300c3d
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed May 28 13:04:25 2008 +1000
do persistent writes in a child process
commit 9e1adfdd4cc606f4134fdeba8d3539e29e7e5056
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue May 27 08:23:46 2008 +1000
update to .40
commit fb9870916ce0798695b09d33208a19d5de1cfd29
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Tue May 27 08:21:18 2008 +1000
read the samba sysconfig from the samba eventscript
commit e07abdfbdb7963309898f0bf5382b8e951409f0a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 18:33:54 2008 +1000
disable transactions for now, there are more situations where there are conflicting locks and the "net" command is not prepared that the persistent store can fail.
commit 437752d002a108bcbbf6dc8bfb5dbf16dc5f1c58
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 16:33:36 2008 +1000
restore a timeout value to the default settings instead of the hardcoded 3 second test value
commit 6f6de0becd179be9eb9a6bf70562b090205ce196
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 16:29:46 2008 +1000
fix some memory hierarchy bugs in allocation of the state structure for persistent writes.
since these two controls (UPDATE_RECORD and PERSISTENT_STORE) can respond
asynchronously to the control, we can not allocate the state variable as a child off ctdb_req_control instead we must allocate state as a child off ctdb itself
and steal ctdb_req_control so it becomes a child of state.
othervise both ctdb_req_control and also state will be released immediately after we have finished setting up the async reply and returned.
commit 3d85d2cf669686f89cacdc481eaa97aef1ba62c0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 13:12:53 2008 +1000
cleanup of the previous patch.
With these patches, ctdbd will enforce and (by default) always use
tdb_transactions when updating/writing records to a persistent database.
This might come with a small performance degratation since transactions
are slower than no transactions at all.
If a client, such as samba wants to use a persistent database but does NOT
want to pay the performance penalty, it can specify TDB_NOSYNC as the
srvid parameter in the ctdb_control() for CTDB_CONTROL_DB_ATTACH_PERSISTENT.
In this case CTDBD will remember that "this database is not that important"
so I can use unsafe (no transaction) tdb_stores to write the updates.
It will be faster than the default (always use transaction) but less crash safe.
commit 7fb6cf549de1b5e9ac5a3e4483c7591850ea2464
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 12:47:33 2008 +1000
second try for safe transaction stores into persistend tdb databases
for stores into persistent databases, ALWAYS use a lockwait child take out the lock for the record and never the daemon itself.
commit 2908e092710d7fa2245161b3315747e17e4226c0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 06:22:25 2008 +1000
update version to .39
commit 92be23dbd6a5bf32d4d1af4a41437fbcd7d8eaf2
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 06:08:38 2008 +1000
move CTDB_MANAGES_NFS from /etc/sysconfig/nfs to /etc/sysconfig/ctdb
commit a953a0fb450955b62d747bdc82c5b968fe0ed378
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 06:04:36 2008 +1000
move the CTDB_MANAGES_ISCSI setting from /etc/sysconfig/iscsi to /etc/sysconfig/ctdb
commit 1ad0295f86370979d0537f7290f5e9c7d1ff6e94
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Thu May 22 06:01:17 2008 +1000
move the config optoin CTDB_MANAGES_VSFTPD from /etc/sysconfig/vsftpd to /etc/sysconfig/ctdb
-----------------------------------------------------------------------
Summary of changes:
client/ctdb_client.c | 36 +++--
common/ctdb_ltdb.c | 64 ++++++--
common/ctdb_util.c | 44 +++++-
common/system_aix.c | 2 +-
common/system_linux.c | 160 ++++++++++----------
config/ctdb.sysconfig | 10 ++
config/events.d/40.vsftpd | 1 +
config/events.d/50.samba | 1 +
config/events.d/60.nfs | 1 +
config/events.d/61.nfstickle | 1 +
config/events.d/70.iscsi | 1 +
config/functions | 1 +
include/ctdb.h | 5 +-
include/ctdb_private.h | 42 ++++-
include/includes.h | 1 +
lib/tdb/common/transaction.c | 2 +-
lib/util/util_time.c | 6 +
packaging/RPM/ctdb.spec | 30 ++++-
server/ctdb_freeze.c | 21 +++-
server/ctdb_persistent.c | 200 ++++++++++++++++++++-----
server/ctdb_recover.c | 13 ++-
server/ctdb_recoverd.c | 343 ++++++++++++++++++++++++++++++------------
server/ctdb_takeover.c | 76 ++++++----
server/ctdb_tunables.c | 1 +
server/ctdb_uptime.c | 5 +-
server/ctdbd.c | 3 +-
server/eventscript.c | 61 ++++++--
tests/ctdb_bench.c | 2 +-
tests/ctdb_fetch.c | 2 +-
tests/ctdb_persistent.c | 153 ++++++++++++++++---
tests/ctdb_randrec.c | 2 +-
tests/ctdb_store.c | 2 +-
tests/ctdb_traverse.c | 2 +-
tests/persistent.sh | 26 +++-
tests/start_daemons.sh | 20 ++-
tools/ctdb.c | 46 ++++---
tools/ctdb_vacuum.c | 4 +-
web/ftp.html | 4 +-
web/iscsi.html | 16 ++-
web/nfs.html | 15 ++-
40 files changed, 1047 insertions(+), 378 deletions(-)
Changeset truncated at 500 lines:
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 921392c..2158d48 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -1640,7 +1640,7 @@ static int ctdb_fetch_func(struct ctdb_call_info *call)
/*
attach to a specific database - client call
*/
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent)
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags)
{
struct ctdb_db_context *ctdb_db;
TDB_DATA data;
@@ -1663,7 +1663,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
data.dsize = strlen(name)+1;
/* tell ctdb daemon to attach */
- ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0,
+ ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, tdb_flags,
persistent?CTDB_CONTROL_DB_ATTACH_PERSISTENT:CTDB_CONTROL_DB_ATTACH,
0, data, ctdb_db, &data, &res, NULL, NULL);
if (ret != 0 || res != 0 || data.dsize != sizeof(uint32_t)) {
@@ -2385,27 +2385,27 @@ int ctdb_ctrl_killtcp(struct ctdb_context *ctdb,
int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
struct timeval timeout,
uint32_t destnode,
- struct sockaddr_in *sin,
+ ctdb_sock_addr *addr,
const char *ifname)
{
TDB_DATA data;
int32_t res;
int ret, len;
- struct ctdb_control_ip_iface *gratious_arp;
+ struct ctdb_control_gratious_arp *gratious_arp;
TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
len = strlen(ifname)+1;
gratious_arp = talloc_size(tmp_ctx,
- offsetof(struct ctdb_control_ip_iface, iface) + len);
+ offsetof(struct ctdb_control_gratious_arp, iface) + len);
CTDB_NO_MEMORY(ctdb, gratious_arp);
- gratious_arp->sin = *sin;
+ gratious_arp->addr = *addr;
gratious_arp->len = len;
memcpy(&gratious_arp->iface[0], ifname, len);
- data.dsize = offsetof(struct ctdb_control_ip_iface, iface) + len;
+ data.dsize = offsetof(struct ctdb_control_gratious_arp, iface) + len;
data.dptr = (unsigned char *)gratious_arp;
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_SEND_GRATIOUS_ARP, 0, data, NULL,
@@ -2685,9 +2685,13 @@ static void async_callback(struct ctdb_client_control_state *state)
*/
if (state->state != CTDB_CONTROL_DONE) {
if ( !data->dont_log_errors) {
- DEBUG(DEBUG_ERR,("Async operation failed with state %d\n", state->state));
+ DEBUG(DEBUG_ERR,("Async operation failed with state %d\n opcode:%u", state->state, data->opcode));
}
data->fail_count++;
+ if (data->fail_callback) {
+ data->fail_callback(ctdb, destnode, res, outdata,
+ data->callback_data);
+ }
return;
}
@@ -2696,12 +2700,17 @@ static void async_callback(struct ctdb_client_control_state *state)
ret = ctdb_control_recv(ctdb, state, data, &outdata, &res, NULL);
if ((ret != 0) || (res != 0)) {
if ( !data->dont_log_errors) {
- DEBUG(DEBUG_ERR,("Async operation failed with ret=%d res=%d\n", ret, (int)res));
+ DEBUG(DEBUG_ERR,("Async operation failed with ret=%d res=%d opcode=%u\n", ret, (int)res, data->opcode));
}
data->fail_count++;
+ if (data->fail_callback) {
+ data->fail_callback(ctdb, destnode, res, outdata,
+ data->callback_data);
+ }
}
if ((ret == 0) && (data->callback != NULL)) {
- data->callback(ctdb, destnode, res, outdata);
+ data->callback(ctdb, destnode, res, outdata,
+ data->callback_data);
}
}
@@ -2746,7 +2755,9 @@ int ctdb_client_async_control(struct ctdb_context *ctdb,
struct timeval timeout,
bool dont_log_errors,
TDB_DATA data,
- client_async_callback client_callback)
+ client_async_callback client_callback,
+ client_async_callback fail_callback,
+ void *callback_data)
{
struct client_async_data *async_data;
struct ctdb_client_control_state *state;
@@ -2756,6 +2767,9 @@ int ctdb_client_async_control(struct ctdb_context *ctdb,
CTDB_NO_MEMORY_FATAL(ctdb, async_data);
async_data->dont_log_errors = dont_log_errors;
async_data->callback = client_callback;
+ async_data->fail_callback = fail_callback;
+ async_data->callback_data = callback_data;
+ async_data->opcode = opcode;
num_nodes = talloc_get_size(nodes) / sizeof(uint32_t);
diff --git a/common/ctdb_ltdb.c b/common/ctdb_ltdb.c
index a3df65e..a6bf268 100644
--- a/common/ctdb_ltdb.c
+++ b/common/ctdb_ltdb.c
@@ -121,9 +121,7 @@ int ctdb_ltdb_fetch(struct ctdb_db_context *ctdb_db,
/*
- fetch a record from the ltdb, separating out the header information
- and returning the body of the record. A valid (initial) header is
- returned if the record is not present
+ write a record to a normal database
*/
int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
struct ctdb_ltdb_header *header, TDB_DATA data)
@@ -150,25 +148,64 @@ int ctdb_ltdb_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
memcpy(rec.dptr, header, sizeof(*header));
memcpy(rec.dptr + sizeof(*header), data.dptr, data.dsize);
+ ret = tdb_store(ctdb_db->ltdb->tdb, key, rec, TDB_REPLACE);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Failed to store dynamic data\n"));
+ }
+
+ talloc_free(rec.dptr);
+
+ return ret;
+}
+
+/*
+ write a record to a persistent database
+ this is done by a child process
+*/
+int ctdb_ltdb_persistent_store(struct ctdb_db_context *ctdb_db, TDB_DATA key,
+ struct ctdb_ltdb_header *header, TDB_DATA data)
+{
+ struct ctdb_context *ctdb = ctdb_db->ctdb;
+ TDB_DATA rec;
+ int ret;
+
+ if (ctdb->flags & CTDB_FLAG_TORTURE) {
+ struct ctdb_ltdb_header *h2;
+ rec = tdb_fetch(ctdb_db->ltdb->tdb, key);
+ h2 = (struct ctdb_ltdb_header *)rec.dptr;
+ if (rec.dptr && rec.dsize >= sizeof(h2) && h2->rsn > header->rsn) {
+ DEBUG(DEBUG_CRIT,("RSN regression! %llu %llu\n",
+ (unsigned long long)h2->rsn, (unsigned long long)header->rsn));
+ }
+ if (rec.dptr) free(rec.dptr);
+ }
+
+ rec.dsize = sizeof(*header) + data.dsize;
+ rec.dptr = talloc_size(ctdb, rec.dsize);
+ CTDB_NO_MEMORY(ctdb, rec.dptr);
+
+ memcpy(rec.dptr, header, sizeof(*header));
+ memcpy(rec.dptr + sizeof(*header), data.dptr, data.dsize);
+
/* if this is a persistent database without NOSYNC then we
will do this via a transaction */
- if (ctdb_db->persistent && !(ctdb_db->client_tdb_flags & TDB_NOSYNC)) {
- bool transaction_started = true;
-
+ if (!(ctdb_db->client_tdb_flags & TDB_NOSYNC)) {
ret = tdb_transaction_start(ctdb_db->ltdb->tdb);
if (ret != 0) {
- transaction_started = false;
- DEBUG(DEBUG_NOTICE, ("Failed to start local transaction\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Failed to start local transaction\n"));
+ goto failed;
}
ret = tdb_store(ctdb_db->ltdb->tdb, key, rec, TDB_REPLACE);
if (ret != 0) {
- if (transaction_started) {
- tdb_transaction_cancel(ctdb_db->ltdb->tdb);
- }
+ DEBUG(DEBUG_ERR, (__location__ " Failed to store persistent data\n"));
+ tdb_transaction_cancel(ctdb_db->ltdb->tdb);
goto failed;
}
- if (transaction_started) {
- ret = tdb_transaction_commit(ctdb_db->ltdb->tdb);
+ ret = tdb_transaction_commit(ctdb_db->ltdb->tdb);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Failed to commit persistent store transaction.\n"));
+ tdb_transaction_cancel(ctdb_db->ltdb->tdb);
+ goto failed;
}
} else {
ret = tdb_store(ctdb_db->ltdb->tdb, key, rec, TDB_REPLACE);
@@ -180,7 +217,6 @@ failed:
return ret;
}
-
/*
lock a record in the ltdb, given a key
*/
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index cb53511..6856c17 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -371,6 +371,25 @@ bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr)
}
/*
+ parse an ip
+ */
+bool parse_ip(const char *addr, ctdb_sock_addr *saddr)
+{
+ char *p;
+ bool ret;
+
+ /* now is this a ipv4 or ipv6 address ?*/
+ p = index(addr, ':');
+ if (p == NULL) {
+ ret = parse_ipv4(addr, 0, saddr);
+ } else {
+ ret = parse_ipv6(addr, 0, saddr);
+ }
+
+ return ret;
+}
+
+/*
parse a ip/mask pair
*/
bool parse_ip_mask(const char *s, struct sockaddr_in *ip, unsigned *mask)
@@ -389,18 +408,39 @@ bool parse_ip_mask(const char *s, struct sockaddr_in *ip, unsigned *mask)
/*
compare two sockaddr_in structures - matching only on IP
*/
-bool ctdb_same_ip(const struct sockaddr_in *ip1, const struct sockaddr_in *ip2)
+bool ctdb_same_ipv4(const struct sockaddr_in *ip1, const struct sockaddr_in *ip2)
{
return ip1->sin_family == ip2->sin_family &&
ip1->sin_addr.s_addr == ip2->sin_addr.s_addr;
}
+bool ctdb_same_ip(ctdb_sock_addr *ip1, ctdb_sock_addr *ip2)
+{
+ if (ip1->sa.sa_family != ip2->sa.sa_family) {
+ return false;
+ }
+
+ switch (ip1->sa.sa_family) {
+ case AF_INET:
+ return ip1->ip.sin_addr.s_addr == ip2->ip.sin_addr.s_addr;
+ case AF_INET6:
+ return !memcmp(&ip1->ip6.sin6_addr.s6_addr[0],
+ &ip2->ip6.sin6_addr.s6_addr[0],
+ 16);
+ default:
+ DEBUG(DEBUG_ERR, (__location__ " CRITICAL Can not compare sockaddr structures of type %u\n", ip1->sa.sa_family));
+ return false;
+ }
+
+ return true;
+}
+
/*
compare two sockaddr_in structures
*/
bool ctdb_same_sockaddr(const struct sockaddr_in *ip1, const struct sockaddr_in *ip2)
{
- return ctdb_same_ip(ip1, ip2) && ip1->sin_port == ip2->sin_port;
+ return ctdb_same_ipv4(ip1, ip2) && ip1->sin_port == ip2->sin_port;
}
diff --git a/common/system_aix.c b/common/system_aix.c
index d455ac7..8742a39 100644
--- a/common/system_aix.c
+++ b/common/system_aix.c
@@ -220,7 +220,7 @@ int ctdb_sys_close_capture_socket(void *private_data)
saddr is the address we are trying to claim
iface is the interface name we will be using to claim the address
*/
-int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
+int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
{
/* We dont do grat arp on aix yet */
return 0;
diff --git a/common/system_linux.c b/common/system_linux.c
index fb50c6b..32db545 100644
--- a/common/system_linux.c
+++ b/common/system_linux.c
@@ -36,7 +36,7 @@
saddr is the address we are trying to claim
iface is the interface name we will be using to claim the address
*/
-int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
+int ctdb_sys_send_arp(const ctdb_sock_addr *addr, const char *iface)
{
int s, ret;
struct sockaddr sa;
@@ -48,92 +48,94 @@ int ctdb_sys_send_arp(const struct sockaddr_in *saddr, const char *iface)
ZERO_STRUCT(sa);
- /* for now, we only handle AF_INET addresses */
- if (saddr->sin_family != AF_INET) {
- DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address (family is %u)\n", saddr->sin_family));
- return -1;
- }
+ switch (addr->ip.sin_family) {
+ case AF_INET:
+ s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
+ if (s == -1){
+ DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
+ return -1;
+ }
- s = socket(AF_INET, SOCK_PACKET, htons(ETHERTYPE_ARP));
- if (s == -1){
- DEBUG(DEBUG_CRIT,(__location__ " failed to open raw socket\n"));
- return -1;
- }
+ /* get the mac address */
+ strcpy(if_hwaddr.ifr_name, iface);
+ ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
+ if ( ret < 0 ) {
+ close(s);
+ DEBUG(DEBUG_CRIT,(__location__ " ioctl failed\n"));
+ return -1;
+ }
+ if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
+ DEBUG(DEBUG_DEBUG,("Ignoring loopback arp request\n"));
+ close(s);
+ return 0;
+ }
+ if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
+ close(s);
+ errno = EINVAL;
+ DEBUG(DEBUG_CRIT,(__location__ " not an ethernet address family (0x%x)\n",
+ if_hwaddr.ifr_hwaddr.sa_family));
+ return -1;
+ }
- /* get the mac address */
- strcpy(if_hwaddr.ifr_name, iface);
- ret = ioctl(s, SIOCGIFHWADDR, &if_hwaddr);
- if ( ret < 0 ) {
- close(s);
- DEBUG(DEBUG_CRIT,(__location__ " ioctl failed\n"));
- return -1;
- }
- if (ARPHRD_LOOPBACK == if_hwaddr.ifr_hwaddr.sa_family) {
- DEBUG(DEBUG_DEBUG,("Ignoring loopback arp request\n"));
- close(s);
- return 0;
- }
- if (if_hwaddr.ifr_hwaddr.sa_family != AF_LOCAL) {
- close(s);
- errno = EINVAL;
- DEBUG(DEBUG_CRIT,(__location__ " not an ethernet address family (0x%x)\n",
- if_hwaddr.ifr_hwaddr.sa_family));
- return -1;
- }
+ memset(buffer, 0 , 64);
+ eh = (struct ether_header *)buffer;
+ memset(eh->ether_dhost, 0xff, ETH_ALEN);
+ memcpy(eh->ether_shost, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
+ eh->ether_type = htons(ETHERTYPE_ARP);
+
+ ah = (struct arphdr *)&buffer[sizeof(struct ether_header)];
+ ah->ar_hrd = htons(ARPHRD_ETHER);
+ ah->ar_pro = htons(ETH_P_IP);
+ ah->ar_hln = ETH_ALEN;
+ ah->ar_pln = 4;
+
+ /* send a gratious arp */
+ ah->ar_op = htons(ARPOP_REQUEST);
+ ptr = (char *)&ah[1];
+ memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
+ ptr+=ETH_ALEN;
+ memcpy(ptr, &addr->ip.sin_addr, 4);
+ ptr+=4;
+ memset(ptr, 0, ETH_ALEN);
+ ptr+=ETH_ALEN;
+ memcpy(ptr, &addr->ip.sin_addr, 4);
+ ptr+=4;
+
+ strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
+ ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
+ if (ret < 0 ){
+ close(s);
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
+ return -1;
+ }
+
+ /* send unsolicited arp reply broadcast */
+ ah->ar_op = htons(ARPOP_REPLY);
+ ptr = (char *)&ah[1];
+ memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
+ ptr+=ETH_ALEN;
+ memcpy(ptr, &addr->ip.sin_addr, 4);
+ ptr+=4;
+ memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
+ ptr+=ETH_ALEN;
+ memcpy(ptr, &addr->ip.sin_addr, 4);
+ ptr+=4;
+
+ strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
+ ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
+ if (ret < 0 ){
+ DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
+ return -1;
+ }
- memset(buffer, 0 , 64);
- eh = (struct ether_header *)buffer;
- memset(eh->ether_dhost, 0xff, ETH_ALEN);
- memcpy(eh->ether_shost, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
- eh->ether_type = htons(ETHERTYPE_ARP);
-
- ah = (struct arphdr *)&buffer[sizeof(struct ether_header)];
- ah->ar_hrd = htons(ARPHRD_ETHER);
- ah->ar_pro = htons(ETH_P_IP);
- ah->ar_hln = ETH_ALEN;
- ah->ar_pln = 4;
-
- /* send a gratious arp */
- ah->ar_op = htons(ARPOP_REQUEST);
- ptr = (char *)&ah[1];
- memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
- ptr+=ETH_ALEN;
- memcpy(ptr, &saddr->sin_addr, 4);
- ptr+=4;
- memset(ptr, 0, ETH_ALEN);
- ptr+=ETH_ALEN;
- memcpy(ptr, &saddr->sin_addr, 4);
- ptr+=4;
-
- strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
- ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
- if (ret < 0 ){
close(s);
- DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
- return -1;
- }
-
- /* send unsolicited arp reply broadcast */
- ah->ar_op = htons(ARPOP_REPLY);
- ptr = (char *)&ah[1];
- memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
- ptr+=ETH_ALEN;
- memcpy(ptr, &saddr->sin_addr, 4);
- ptr+=4;
- memcpy(ptr, if_hwaddr.ifr_hwaddr.sa_data, ETH_ALEN);
- ptr+=ETH_ALEN;
- memcpy(ptr, &saddr->sin_addr, 4);
- ptr+=4;
-
- strncpy(sa.sa_data, iface, sizeof(sa.sa_data));
- ret = sendto(s, buffer, 64, 0, &sa, sizeof(sa));
- if (ret < 0 ){
- DEBUG(DEBUG_CRIT,(__location__ " failed sendto\n"));
+ break;
+ default:
+ DEBUG(DEBUG_CRIT,(__location__ " not an ipv4 address (family is %u)\n", addr->ip.sin_family));
return -1;
}
- close(s);
return 0;
}
diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig
index 58edbff..25b3f28 100644
--- a/config/ctdb.sysconfig
+++ b/config/ctdb.sysconfig
@@ -46,6 +46,16 @@
# if left comented out then it will be autodetected based on smb.conf
# CTDB_MANAGES_WINBIND=yes
+# should ctdb manage starting/stopping the VSFTPD service
+# CTDB_MANAGES_VSFTPD=yes
+
+# should ctdb manage starting/stopping the ISCSI service
+# CTDB_MANAGES_ISCSI=yes
+
+# should ctdb manage starting/stopping the NFS service
+# CTDB_MANAGES_NFS=yes
+
+
# you may wish to raise the file descriptor limit for ctdb
# use a ulimit command here. ctdb needs one file descriptor per
--
CTDB repository
More information about the samba-cvs
mailing list