1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

2624 Commits

Author SHA1 Message Date
Rusty Russell
e548a335bd eventscript: use wire format internally for script status.
The only difference between the exposed an internal structure now is
that the name and output fields were pointers.  Switch to using
ctdb_scripts_wire/ctdb_script_wire internally as well so marshalling
is a noop.

We now reject scripts which are too long and truncate logging to the
511 characters we have space for (the entire output will be in the
normal ctdbd log).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit fd2f04554e604bc421806be96b987e601473a9b8)
2009-12-08 12:48:17 +10:30
Rusty Russell
9753b7e793 eventscript: rename ctdb_monitoring_wire to ctdb_scripts_wire
We're going to allow fetching status of all script runs, so this
name is no longer appropriate.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit f5cb41ecf3fa986b8af243e8546eb3b985cd902a)
2009-12-08 00:51:24 +10:30
Rusty Russell
3ff8bf8138 eventscript: get_current_script() helper
This neatens the code slightly.  We also use the name 'current' in
ctdb_event_script_handler() for uniformity.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit e9661b383e0c50b9e3d114b7434dfe601aff5744)
2009-12-08 12:47:24 +10:30
Rusty Russell
cc678d572f eventscript: use an array rather than a linked list of scripts
This brings us closer to the wire format, by using a simple array
and a 'current' iterator.

The downside is that a 'struct ctdb_script' is no longer a talloc
object: the state must be passed to our log fn, and the current
script extracted with &state->scripts->scripts[state->current].

The wackiness of marshalling is simplified, and as a bonus, we can
distinguish between an empty event directory
(state->scripts->num_scripts == 0) and and error (state->scripts ==
NULL).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 76e8bdc11b953398ce8850de57aa51f30cb46bff)
2009-12-08 12:47:05 +10:30
Rusty Russell
1eda08ea29 eventscript: record script status for all events
This unifies almost everything: the state->current pointer points to
the struct ctdb_script where we record start, finish, status and
output.

We still only marshall up the monitor events; the rest disappear when
the state structure is freed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit c476c81f3e3d8fc62f2e53d82fce5774044ee9ce)
2009-12-08 12:46:18 +10:30
Rusty Russell
9b50f7ee67 eventscript: use scripts array directly, rather than separate list
We rename ctdb_monitor_script_status to ctdb_script, and instead of
allocating them as the scripts are executed, we allocate them up front
and keep a "current" interator.

This slightly simplifies the code, though it means we only marshall up
to the last successfully run script.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit b2a300768536d10bd867a987ad4cf1c5268c44bc)
2009-12-08 12:45:17 +10:30
Rusty Russell
23e24c503c eventscript: ctdb_fork_with_logging()
A new helper functions which sets up an event attached to the child's
stdout/stderr which gets routed to the logging callback after being
placed in the normal logs.

This is a generalization of the previous code which was hardcoded to
call ctdb_log_event_script_output.

The only subtlety is that we hang the child fds off the output buffer;
the destructor for that will flush, which means it has to be destroyed
before the output buffer is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 32cfdc3aec34272612f43a3588e4cabed9c85b68)
2009-12-08 12:44:30 +10:30
Rusty Russell
e84d2f7edb eventscript: pass struct ctdb_log_state directly to ctdb_log_handler().
The current logging logic assumes that any stdout/stderr belongs to
the currently running monitor script output.  This isn't quite right
anyway, and we'd like to capture stderr output of other script
invocations.

So we move towards multiple struct ctdb_log_state by handing it
directly to ctdb_log_handler to use, rather than having it assume
ctdb->log.  We need a ctdb pointer inside the log struct now though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 497766cf186442de00fb324343150442457be858)
2009-12-08 00:31:29 +10:30
Rusty Russell
c309d22f9a eventscript: remove unused ctbd_ctrl_event_script*
The child no longer uses ctdb_ctrl_event_script_init or
ctdb_ctrl_event_script_finished, and the others are redundant: it
doesn't need to tell us it's starting a script when it only runs one.

We move start and stop calls to the parent, and eliminate the RPC
infrastructure altogether.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 391926a87a7af73840f10bb314c0a2f951a0854c)
2009-12-08 00:27:40 +10:30
Rusty Russell
69c30c6ba0 eventscript: refactor forking code into fork_child_for_script()
We do the same thing in two places: fire off a child from the initial
ctdb_event_script_callback_v() and also from the ctdb_event_script_handler()
when it's done.

Unify this logic into fork_child_for_script().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 814704a3286756d40c2a6c508c1c0b77fa711891)
2009-12-08 00:22:55 +10:30
Rusty Russell
dd53eee7a2 eventscript: fork() a child for each script.
We rename child_run_scripts() to child_run_script(), because it now
runs a single script rather than walking the list.  When it's
finished, we fork the next child from the ctdb_event_script_handler()
callback.

ctdb_control_event_script_init() and ctdb_control_event_script_finished()
are now called directly by the parent process; the child still calls
ctdb_ctrl_event_script_start() and ctdb_ctrl_event_script_stop() before
and after the script.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 0fafdcb8d3532a05846abaa5805b2e2f3cee8f47)
2009-12-08 00:21:25 +10:30
Rusty Russell
640b22ff61 eventscript: store from_user and script_list inside state structure
This means all the state about running the scripts is in that structure,
which helps in the next patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 020fd21e0905e7f11400f6537988645987f2bb32)
2009-12-08 00:15:18 +10:30
Rusty Russell
b8e347ec9c eventscript: use direct script state pointer for current monitor
We put a "scripts" member in ctdb_event_script_state, rather than using
a special struct for monitor events.  This will fit better as we further
unify the different events, and holds the reports from the child process
running each monitor script.

Rather than making the monitor state a child of current_monitor_status_ctx,
we just point current_monitor directly at it.  This means we need to reset
that pointer in the destructor for ctdb_event_script_state.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 9a2b4f6b17e54685f878d75bad27aa5090b4571f)
2009-12-08 00:14:01 +10:30
Rusty Russell
a4c2a98ba9 eventscript: make current_monitor_status_ctx serve as monitor_event_script_ctx
We have monitor_event_script_ctx and other_event_script_ctx, and
current_monitor_status_ctx in struct ctdb_context.  This seems more
complex than it needs to be.

We use a single "event_script_ctx" as parent for all event script
state structures.  Then we explicitly reparent monitor events under
current_monitor_status_ctx: this is freed every script invocation to
kill off any running scripts anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 0d925e6f2767691fa561f15bbb857a2aec531143)
2009-12-08 00:09:20 +10:30
Rusty Russell
68e224d9a4 eventscript: split ctdb_run_event_script into multiple parts
Simple refactoring in preparation for switching to one-child-per-script.
We also call the functions run by the child process "child_".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit bfee777faff75e9bed4aedc1558957483616a6d3)
2009-12-07 23:55:03 +10:30
Rusty Russell
9a0c171fa7 eventscript: hoist work out of child process, into parent
This is the start of a move towards finer-grained reporting, with one
child per script.  Simple code motion to do sanity check and get the
list of scripts before fork().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 816b9177f51ae5b21b92ff4a404f548fe9723c96)
2009-12-07 23:53:35 +10:30
Rusty Russell
9914d3f561 eventscript: don't make ourselves healthy if we're under ban_count
If we've timed out, but we've not timed out more than
ctdb->tunable.script_ban_count, we pretend we haven't.

There's a logic bug in the way this is done: if we were unhealthy before,
this would set us to "healthy" again (status == 0).  I don't think this
would happen in real life, but it's a little surprising.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit e6488c0e05bab5c4c2c0a6370930b0b27e5ed56e)
2009-12-07 23:52:01 +10:30
Rusty Russell
928b8dcb31 eventscript: handle banning within the callbacks
Currently the timeout handler in eventscript.c does the banning if a
timeout happens.  However, because monitor events are different, it has
to special case them.

As we call the callback anyway in this case, we should make that handle
-ETIME as it sees fit: for everyone but the monitor event, we simply ban
ourselves.  The more complicated monitor event banning logic is now in
ctdb_monitor.c where it belongs.

Note: I wrapped the other bans in "if (status == -ETIME)", though they
should probably ban themselves on any error.  This change should be a
noop.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 9ecee127e19a9e7cae114a66f3514ee7a75276c5)
2009-12-07 23:48:57 +10:30
Rusty Russell
5190932507 eventscript: expost ctdb_ban_self()
eventscript.c uses this now, but our next patch makes others use it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit a305cb7743c24386e464f6b2efab7e2108bb1e7e)
2009-12-07 23:18:40 +10:30
Rusty Russell
0dd46797d6 eventscript: handle v. unlikely timeout race
If we time out just as the child exits, we currently will report an
uninitialized cb_status field.  Set it to -ETIME as expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 024386931bda9757079f206238ae09bae4de6ea2)
2009-12-07 23:17:23 +10:30
Rusty Russell
d5d88ecaaf eventscript: replace other -1 returns with -errno
This completes our "problem with script" reporting; we never set cb_status
to -1 on error.  Real errnos are used where the failure is a system call
(eg. read, setpgid), otherwise -EIO is used if we couldn't communicate with
the parent.

The latter case is a bit useless, since the parent probably won't see
the error anyway, but it's neater.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 1269458547795c90d544371332ba1de68df29548)
2009-12-07 23:15:56 +10:30
Rusty Russell
672e06f438 eventscript: simplify ctdb_run_event_script loop
If we break, we avoid cut & paste code inside the loop.  Need to initialize
ret to 0 for the "no scripts" case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit ec36ced9446da7e3bf866466d265ee8e18f606c1)
2009-12-07 23:13:12 +10:30
Rusty Russell
c70afe0cd4 eventscript: handle and report generic stat/execution errors
Rather than ignoring deleted event scripts (or pretending that they were "OK"),
and discarding other stat errors, we save the errno and turn it into a negative
status.

This gives us a bit more information if we can't execute a script (eg.
too many symlinks or other weird errors).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 5d894e1ae5228df6bbe4fc305ccba19803fa3798)
2009-12-07 23:12:19 +10:30
Rusty Russell
b9b75bd065 eventscript: use -ENOEXEC for disabled status value
This unifies code paths and simplifies things: we just hand -ENOEXEC to
ctdb_ctrl_event_script_stop().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit eadf5e44ef97d7703a7d3bce0e7ea0f21cb11f14)
2009-12-07 23:11:47 +10:30
Rusty Russell
ce378014c7 eventscript: enhance script delete race check
We currently assume 127 == script removed.  The script can also return 127;
best to re-check the execution status in this case (and for 126, which will
happen if the script is non-executable).

If the script is no longer executable/not present, we ignore it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 0a53d6b5ac81daf0efa32f35e7758ede2a5bdb63)
2009-12-07 23:09:02 +10:30
Rusty Russell
8993d6f523 eventscript: check_executable() to centralize stat/perm checks
This is used later in the "script vanished" check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 8ddb97040842375daf378cbb5816d0c2b031fa65)
2009-12-07 23:09:39 +10:30
Rusty Russell
949803528d talloc: save errno over talloc_free
As we start to use errno more, it's a huge pain if talloc_free() can blatt
it (esp. destructors).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 76a0ca77feba14e1e1162c195ffbdf516e62aa4d)
2009-12-07 23:05:58 +10:30
Rusty Russell
066a791770 eventscript: use -ETIME for timeout status value
This starts the move toward more expressive encoding of return values:
positive values mean the script ran, negative means we had a problem with
the script (and the value is the errno).

This does timeout, but changes the ctdb tool to recognize it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 0eb1d0aa14e68b598d9e281c8a02b8f94a042fd9)
2009-12-07 23:09:42 +10:30
Rusty Russell
85a6f4a4dd eventscript: marshall onto last_status immediately
This simplifies the code a little: last_status is now read to go
(it's only used by the scriptstatus command at the moment).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 6be931266a4e41fd0253f760936ad9707dd97c47)
2009-12-07 23:09:40 +10:30
Ronnie Sahlberg
2c80c91c87 version 1.0.108
(This used to be ctdb commit fff280878e670e93a818c0071f3172056214e8c4)
2009-12-07 19:04:41 +11:00
Ronnie Sahlberg
cdabe16777 Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state.
(This used to be ctdb commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6)
2009-12-07 18:27:46 +11:00
Michael Adam
3420278b3a packaging: package tests/bin/ctdb_transaction under /usr/share/doc/tests/bin
For testing/diagnostic purposes.

Michael

(This used to be ctdb commit b796d736946856abfbe53de95dfcd73072ee8ccd)
2009-12-04 23:18:12 +01:00
Michael Adam
98c108fa33 client: improve two error messages in ctdb_transaction_commit().
Michael

(This used to be ctdb commit d971b2ca84c0451dc7e5acbf4a5ade06270a2044)
2009-12-04 15:06:54 +01:00
Michael Adam
c1039fba0e server:trans2_commit: move the check for active recovery down.
This needs to be done after the control-dispatcher:
In the TRANS2_COMMIT control, the client->db_id needs
to be set before bailing out, since otherwise the
next TRANS2_COMMIT_RETRY will fail...

Michael

(This used to be ctdb commit 59faf3f923a5989b5ee94ef02a12827412775bae)
2009-12-04 15:03:21 +01:00
Michael Adam
cc7438d87d client: increase the number of commit retries 10-->100
To cope with timeouts when recoveries and transactions collide.
Maybe 100 is too high.

Michael

(This used to be ctdb commit c23d804165e84bdf95ba960c953c736d361011d7)
2009-12-04 15:03:16 +01:00
Michael Adam
b3fd495522 client: untangle checks and produce more detailed error messages
in ctdb_transaction_fetch_start

Michael

(This used to be ctdb commit 428914377851a98b3fc893798783fbfebffc1c0d)
2009-12-04 15:03:16 +01:00
Michael Adam
7afefed6ae client: increase the rsn of the __transaction_lock__ when storing
So that it is correctly handled by recoveries.
Also explicitly set the dmaster field to the current node's pnn.

Michael

(This used to be ctdb commit 03a5bb727b9db1ba952632f08ceb5355f0df842d)
2009-12-04 15:02:41 +01:00
Michael Adam
ffe62722cb recovery: add special pull-logic for persistent databases
The decision mechanism which records of a persistent db
are to be pulled into the recdb during recovery is now
as follows:

* Usually a record with the higher rsn than that already
  stored is taken. (Just as for normal tdbs.)

* If a transaction is running on some node, then those
  nodes copies of all records are taken and are not
  overwritten later by other nodes' copies.

In order to keep track of whether a record's copy was obtained
from a node with a transaction running, the recovery mechanism
misuses the ctdb tdb header field 'lacount' in the recdb.
It is cleared later when pushing out the recdb database to the
other nodes.

This way, an incomplete transaction is not spoiled when
a recovery interrupts and the replay should usually succeed
(possibly after a few retries).

Michael

(This used to be ctdb commit 8aef46d2aab3efb322dda51eaa202653cefd5222)
2009-12-04 15:00:21 +01:00
Michael Adam
0635f8b98f make ctdb_ctrl_transaction_active public.
Michael

(This used to be ctdb commit e5496a83ef4a01604195b27c4b97f50d4979510e)
2009-12-04 11:30:22 +01:00
Michael Adam
9a8134e862 recovery: for persistent db's don't set the dmaster to the recmaster node number
It is important to keep track of the dmaster (i.e. the node that last committed
a transaction containing changes to this node).

Michael

(This used to be ctdb commit fe68972eb9cf3aa1f16ba1aacf57ade5d66e647c)
2009-12-04 11:30:21 +01:00
Michael Adam
f96e8166de recovery: pass the persistent flag to recover_database()
and further down to pull_remote_database(), pull_one_remote_database(),
and push_recdb_database().

This is in preparation of special handling of persistent databases
during recoveries.

Michael

(This used to be ctdb commit 90abc4ac7c16e854cf6e8f96b60a77bc92e35e07)
2009-12-04 11:30:21 +01:00
Michael Adam
814e3c501f tests:ctdb_transaction: print an extra counters when a commit fails
Michael

(This used to be ctdb commit 4113385865f53a57b18ea752a7dad8a08bed588e)
2009-12-04 11:30:21 +01:00
Michael Adam
27dc0adfb5 client: in catdb, print the keyname first, and separate records by a blank line
Michael

(This used to be ctdb commit b9882710e12f28c96a0af298e419160f00578241)
2009-12-04 11:30:21 +01:00
Michael Adam
f09090f9ba packaging: remove the lib/popt from the tarball in debian mode
Debian CTDB packaging fails when this is included.

Michael

(This used to be ctdb commit 574702f8d701fe3e493b31948420b2981eb36f93)
2009-12-04 11:30:21 +01:00
Michael Adam
522c60182e packaging: rework maketarball.sh to accept an arbitrary githas to pack
The githash can be specified through the environment variable "GITHASH"
that can contain a commit hash or a tag name, e.g.

The call syntax is now

[GITHASH=xyz] [USE_GITHASH=yes/no] [DEBIAN_MODE=yes/no] maketarball.sh

Michael

(This used to be ctdb commit 41aa9bdfa2934f564bdc14374362437dfad0045f)
2009-12-04 11:30:20 +01:00
Michael Adam
92c5d9eefc ctdb: add command "ctdb wipedb" to wipe the contents of an attached tdb
Michael

(This used to be ctdb commit 5a7c1e7f15693522bbf1c39a53be2304ece9a134)
2009-12-04 11:30:20 +01:00
Michael Adam
0213cb4d0b tests: turn printfs into DEBUG statements in the ctdb_transaction test
Michael

(This used to be ctdb commit 0e130d79ab71cf3aa65c40af91866823246a0283)
2009-12-04 11:30:20 +01:00
Martin Schwenke
7b6072b63d Merge branch 'status-test-2'
(This used to be ctdb commit 5fc297a6bd49d9366703eef3edb9bdf0fe8505cc)
2009-12-04 14:44:46 +11:00
Ronnie Sahlberg
e28c652cca Dont store debug level DEBUG_DEBUG in the in-memory ringbuffer.
It is unlikely we will need something this verbose for normal troubleshooting.
This allows us to keep a significantly longer time interval of log messages
in the 500k slots available in the ringbuffer.

(This used to be ctdb commit cc99c05c0c6484ad574039a454e6133852cb41fa)
2009-12-04 11:45:37 +11:00
Ronnie Sahlberg
8f442f1c0c Use statically allocated ringbuffer to store the last 500k log entries
in memory instead of dynamically allocated ones so that we reduce the pressure
on malloc/free.

(This used to be ctdb commit c5cbb95512f034abeec515579983bf7ac55eadd9)
2009-12-04 11:36:27 +11:00
Ronnie Sahlberg
daae501d91 Document the procedure to remove/change the NATGW configuration at
runtime without restarting the ctdb service

(This used to be ctdb commit 0a0526e03ef995b6b6634f5b75c7a17cb7b5df8f)
2009-12-04 08:33:56 +11:00
Rusty Russell
774bf144c1 eventscript: reduce code duplication for ending a script, and fix bug
Commit 50c2caed57c0 removed a gratuitous talloc_steal from the code in
ctdb_control_event_script_finished(), but not ctdb_event_script_timeout().

Easiest to call ctdb_control_event_script_finished() at the bottom of the
timeout routine.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 17fa252d0d6981fbae8083a818f26d5ce9c5102e)
2009-12-02 16:15:57 +10:30
Ronnie Sahlberg
e56c5b2a67 lower the loglevel for the message that a client has attached to a persistent database
(This used to be ctdb commit 2027cf3881ba890648c543bacbfd5b06464efc10)
2009-12-02 14:53:21 +11:00
Ronnie Sahlberg
fab11acc65 lower the loglevel for the message that a client has attached through a domian socket
(This used to be ctdb commit de9e5236b20d70eac5ed29991703d6d25a103963)
2009-12-02 14:51:57 +11:00
Ronnie Sahlberg
6bad4a4836 Add a proper function to process a process-exist control in the daemon.
This controls is only used by samba when samba wants to check if a subrecord held by a <node-id>:<smbd-pid> is still valid or if it can be reclaimed.

If the node is banned or stopped, we kill the smbd process and return that the process does not exist to the caller. This allows us to recover subrecords from stopped/banned nodes where smbd is hung waiting for the databases to thaw.

bz58185

(This used to be ctdb commit 157807af72ed4f7314afbc9c19756f9787b92c15)
2009-12-02 13:58:27 +11:00
Ronnie Sahlberg
1c7de7a2ed Add a double linked list to the ctdb_context to store a mapping between client pids and client structures.
Add the mapping to the list everytime we accept() a new client connection
and set it up to remove in the destructor when the client structure is freed.

(This used to be ctdb commit f75d379377f5d4abbff2576ddc5d58d91dc53bf4)
2009-12-02 13:41:04 +11:00
Ronnie Sahlberg
bf27dc2d53 Use the PID we pick up from the domain socket when a client connects
and store this in the client structure.

There is no need to rely on the hack that samba sends some special message
handle registrations that encodes the pid in the srvid any more.

This might not work on AIX since I recall some issues to get the pid in
this way on that platform.

(This used to be ctdb commit b4a7efa7e53e060a91dea0e8e57b116e2aeacebf)
2009-12-02 13:17:12 +11:00
Ronnie Sahlberg
2b4fbe5c41 version 1.0.107
(This used to be ctdb commit 22f00368b4cb3a6bfb92033a7dbe693d31b41a54)
2009-12-02 11:28:42 +11:00
Rusty Russell
9e84872ecd ctdb_io: fix use-after-free on invalid packets
Wolfgang saw a talloc complaint about using freed memory in ctdb_tcp_read_cb.
His fix was to remove the talloc_free() in that function, which causes
loops when a socket is closed (as it does not get removed from the event
system), eg:
	netcat 192.168.1.2 4379 < /dev/null

The real bug is that when we have more than one pending packet in the
queue, we loop calling the callback without any safeguards should that
callback free the queue (as it tends to do on invalid packets).  This
can be reproduced by sending more than one bogus packet at once:
	# Length word at start: 4 == empty packet (assumed little endian)
	/usr/bin/printf \\4\\0\\0\\0\\4\\0\\0\\0 > /tmp/pkt
	netcat 192.168.1.2 4379 < /tmp/pkt

Using a destructor we can check if the callback frees us, and exit
immediately.  Elsewhere, we return after the callback anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 4d0523dd94fb07e860b3e8118691f93d1ef8d0fa)
2009-12-02 11:27:23 +11:00
Ronnie Sahlberg
6f045cad29 version 1.0.106
(This used to be ctdb commit b5a21fd39269a6e2a9d1c8182dd42a1773ccbb3f)
2009-12-02 11:26:51 +11:00
Martin Schwenke
b17bf38c64 Eventscripts: Fix syntax error in 00.ctdb.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 9ea261f791ab919eb1ce5b37073b4f1d30694bb8)
2009-12-01 18:08:57 +11:00
Michael Adam
016d092169 packaging:maketarball.sh: add a DEBIAN_MODE to the tarball creation
It is triggered by setting DEBIAN_MODE=yes in the environment.
This creates a tarball suitable for use in debian packages.
The differences from the standard tarball are these:

* The tar ball file is called ctdb_VERSION.orig.tar.gz
* The base directory in the tar ball is ctdb-VERSION.orig/

Michael

(This used to be ctdb commit 83e7c161efa93cd7acdfc803142b4fb3bfde7538)
2009-12-01 18:02:20 +11:00
Michael Adam
15bd5fb8e7 configure:maketarball.sh: call autogen.sh and include configure in the tarball
Michael

(This used to be ctdb commit bc8aee079e09164e06533a1474f5e9d899795933)
2009-12-01 18:02:05 +11:00
Michael Adam
7430da3839 packaging:maketarball.sh: create the specfile from the ctdb.spec.in
Michael

(This used to be ctdb commit bb8d02abd88899d259085b9b23fa52accb222be9)
2009-12-01 18:01:46 +11:00
Martin Schwenke
50a26cf75e Eventscripts: Remove executable bit accidently set on some scripts.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 4c6e68ae942c05224c5f8b683fbc2dc1adced8ee)
2009-12-01 17:54:45 +11:00
Martin Schwenke
db25ca69e5 Eventscript argument cleanups and introduction of ctdb_standard_event_handler.
The functions file no longer causes a side-effect by doing a shift.
It also doesn't set a convenience variable for $1.

All eventscripts now explicitly use "$1" in their case statement, as
does the initscript.  The absence of a shift means that the
takeip/releaseip events now explicitly reference $2-$4 rather than
$1-$3.

New function ctdb_standard_event_handler handles the status and
setstatus events, and exits for either of those events.  It is called
via a default case in each eventscript, replacing an explicit status
case where applicable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3d55408cbbb3bb71670b80f3dad5639ea0be5b5b)
2009-12-01 17:43:47 +11:00
Ronnie Sahlberg
2000711cb1 when we detect a ip-allocation mismatch, just force a new ip reassignment
instead of a full blown recovery

(This used to be ctdb commit 4f50aa8bb8be544058523f2f544109a26c2b3b51)
2009-12-01 16:06:59 +11:00
Ronnie Sahlberg
698a0e4e9a When starting up ctdbd, wait until all initial recoveries have finished
and until we have gone through a full re-recovery timeout without triggering
any pending recoveries before we start up the services and start monitoring
the node.

(This used to be ctdb commit 821333afb458358f90446062b0242790695e5060)
2009-12-01 13:19:58 +11:00
Ronnie Sahlberg
569001afd0 Merge commit 'martins/status-test-2'
Conflicts:

	server/eventscript.c

(This used to be ctdb commit e9b3477a5b9a2eff18f727e7d59338bfb5214793)
2009-12-01 10:53:18 +11:00
Martin Schwenke
ad431c3520 Event scripts: functions file now intercepts status and setstatus.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a1f37fdc5217e57d2d643d77a811afca747685e0)
2009-11-27 15:57:33 +11:00
Ronnie Sahlberg
3bc643b46b remove a stray ) so we compile
(This used to be ctdb commit 16db4882635d84b8410a77e2ea8b08d0a257b0ab)
2009-11-27 13:35:39 +11:00
Ronnie Sahlberg
266a163c89 dont use talloc_steal() on a object that is already a child of ctdb.
(This used to be ctdb commit 50c2caed57c0520f506eaaeeb0bba2c272da6ef6)
2009-11-27 13:28:31 +11:00
Ronnie Sahlberg
eaa6218def Merge commit 'martins/status-test' into status-test-2
(This used to be ctdb commit 937823cc73eb098230acff4b1583f6d01f26c21a)
2009-11-27 12:50:45 +11:00
Martin Schwenke
dc2c8dfde1 Merge commit 'martins-svart/status-test-2' into status-test
(This used to be ctdb commit 0e6c06ac38fd82adf124d111717502055501974a)
2009-11-27 12:49:31 +11:00
Martin Schwenke
ce06d3de46 Event script infrastructure: add reload event to check_options().
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c278c798d41a35f58ca81f8f0e08e4dab51eba9b)
2009-11-27 12:04:02 +11:00
Ronnie Sahlberg
09b9bb2f9f Merge commit 'martins/status-test' into status-test-2
(This used to be ctdb commit 28d0648725e7de4e4d0e8569e3fbfb0fa1d7f934)
2009-11-26 16:26:25 +11:00
Martin Schwenke
88cd194d6a Merge commit 'martins-svart/status-test-2' into status-test
(This used to be ctdb commit 143f1fa3cc4588505e3992c601153ea08be8432d)
2009-11-26 16:25:15 +11:00
Martin Schwenke
a64ccf07c1 Add flag to ctdb_event_script_callback indicating when called by client.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a1d654a982ca56fade82552f4e6b5586236d3233)
2009-11-26 15:49:49 +11:00
Ronnie Sahlberg
ed4f3ea3cc resolve some conflicts from merging from martins branch
(This used to be ctdb commit d3e7407dc9854ec358d081777c5450ec68b17862)
2009-11-26 13:42:12 +11:00
Ronnie Sahlberg
e17fa0fdee change the lock wait child handling to use a pipe isntead of a socketpair
remove a stray alarm(30) that caused databases to be unlocked after 30 seconds.

(This used to be ctdb commit 12b187f971d857353403393a9850503e0e558672)
2009-11-26 12:08:35 +11:00
Martin Schwenke
8029db6a91 Merge commit 'martins-svart/status-test-2' into status-test
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit a2830594ebeb54eb51ff90999cb12370aeec6e8b)
2009-11-26 10:49:47 +11:00
Martin Schwenke
ece15620c0 Event scripts: use $script_name rather than $service name for status.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 517e9d9b188b18dffc712a8fecddb41540d27b8d)
2009-11-25 16:42:14 +11:00
Martin Schwenke
ee10ea202b Event scripts: Respect CTDB_MANAGES_NFS and add function log_status_cat.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5d97c07be13a8209a81dfc8f73e49371949e4dc3)
2009-11-25 16:34:49 +11:00
Martin Schwenke
1edcb89948 More eventscript cleanups. Initial smoke testing seems OK.
Apart from lots of cleanup work, this also fixes a bug where the share
checks didn't used to cope with directory names containing spaces.
The previous commit also loaded the config incorrectly.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 3c93336ab92c2e4829ff4dc360045bfa6df21d50)
2009-11-25 16:30:47 +11:00
Ronnie Sahlberg
926261aafc use a binary tree and sort all ipv4/v6 addresses before we assign them out on nodes.
(This used to be ctdb commit 862526e558099fad4c8259cb88da9b776aa7f80d)
2009-11-25 11:54:40 +11:00
Rusty Russell
3188df4a88 eventscript: check that ctdb forced script events correct
Now we're doing checking, we might as well make sure the commands from
"ctdb eventscripts" are valid.

This gets rid of the "UNKNOWN" event type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 1d24a3869fe89fc9a109fd9e9b69df5fc665a5f6)
2009-11-25 11:02:29 +10:30
Ronnie Sahlberg
cd44c8b4e5 iIt is better to plainly disallow clietnts from connecting here
if the node is BANNED.
Dont even let them attach at all
to the database

Revert "temporarily try allowing clients to attach to databases even if
the node is banned/stopped or inactive in any other way."

This reverts commit 227fe99f105bdc3a4f1000f238cbe3adeb3f22f0.

(This used to be ctdb commit 10a3680fb3917ecafc824e73872eace321026172)
2009-11-25 08:03:42 +11:00
Martin Schwenke
1c7445d547 Merge commit 'origin/status-test' into status-test
(This used to be ctdb commit 2e60749de3714239224cc04170a9aeeee158153f)
2009-11-24 16:14:54 +11:00
Rusty Russell
ff59bb34af eventscript: check that ctdb forced script events correct
Now we're doing checking, we might as well make sure the commands from
"ctdb eventscripts" are valid.

This gets rid of the "UNKNOWN" event type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 66b22980b14601f29fe8cc64bd8f29883c7ca1c0)
2009-11-24 11:24:22 +10:30
Rusty Russell
0b4b83aea0 eventscript: check that internal script events are being invoked correctly
This is not as good as a compile-time check, but at least we count the
number of arguments are correct.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 83b7b233cb4707e826f6ba260bd630c8bc8f1e76)
2009-11-24 11:23:13 +10:30
Rusty Russell
187efa08ab eventscript: check that internal script events are being invoked correctly
This is not as good as a compile-time check, but at least we count the
number of arguments are correct.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit a6d353519932eee48f9241ad8887b692882906c9)
2009-11-24 11:23:13 +10:30
Rusty Russell
534c709cba eventscript: remove call name from state->options
Finally, we remove the call name (eg. "monitor" or "start") from the
options field of the struct: it now contains only extra options.

This is clearer, and mainly involves adding some %s to debug statements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 33fb0e7ba047ca73969b59bccf70a04a17c25a0a)
2009-11-24 11:22:46 +10:30
Rusty Russell
0ef91a4e1f eventscript: remove call name from state->options
Finally, we remove the call name (eg. "monitor" or "start") from the
options field of the struct: it now contains only extra options.

This is clearer, and mainly involves adding some %s to debug statements.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit b0648c7f08eba87ec3c9714e2525c9b621bfb4ef)
2009-11-24 11:22:46 +10:30
Rusty Russell
461f52736d eventscript: put call type into state struct.
This means we can get rid of more strcmp; they can simply use the
state->call value instead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 6c79fa33e26cc4f0873577f8e122b1495b4c427e)
2009-11-24 11:19:58 +10:30
Rusty Russell
205011cb61 eventscript: put call type into state struct.
This means we can get rid of more strcmp; they can simply use the
state->call value instead.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 834c93b3e1b8f4151b8a2cd82c2dd8bacc17f66c)
2009-11-24 11:19:58 +10:30
Rusty Russell
2d9254404d eventscript: introduce enum for different event script calls.
Rather than doing strcmp everywhere, pass an explicit enum around.  This
also subtly documents what options are available.  The "options" arg
is now used for extra arguments only.

Unfortunately, gcc complains on empty format strings, so we make
ctdb_event_script() take no varargs, and add ctdb_event_script_args().  We
leave ctdb_event_script_callback() taking varargs, which means callers
have to do "%s", "".

For the moment, we have CTDB_EVENT_UNKNOWN for handling forced scripts
from the ctdb tool.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 8001488be4f2beb25e943fe01b2afc2e8779930d)
2009-11-24 11:16:49 +10:30
Rusty Russell
e0c6e2f489 eventscript: introduce enum for different event script calls.
Rather than doing strcmp everywhere, pass an explicit enum around.  This
also subtly documents what options are available.  The "options" arg
is now used for extra arguments only.

Unfortunately, gcc complains on empty format strings, so we make
ctdb_event_script() take no varargs, and add ctdb_event_script_args().  We
leave ctdb_event_script_callback() taking varargs, which means callers
have to do "%s", "".

For the moment, we have CTDB_EVENT_UNKNOWN for handling forced scripts
from the ctdb tool.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 470822b329f9d3ca9bef518b56e9ce28d5fedda2)
2009-11-24 11:16:49 +10:30
Rusty Russell
2763df22de eventscript: put timeout inside ctdb_event_script_callback_v
Everyone uses the same timeout value, so just remove it from the API.
If we ever need variable timeouts, that might as well be central too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 533c3e053293941d2a9484b495e78d45f478bb08)
2009-11-24 11:09:46 +10:30
Rusty Russell
5dee5769d3 eventscript: put timeout inside ctdb_event_script_callback_v
Everyone uses the same timeout value, so just remove it from the API.
If we ever need variable timeouts, that might as well be central too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit fe8027309c1f7b987cd368fa98f9b28741baa786)
2009-11-24 11:09:46 +10:30
Rusty Russell
3845c6e5b8 eventscript: cleanup ctdb_event_script_v
ctdb_event_script_v doesn't take varargs.  ctdb_run_event_script is
a better name, and fix comment.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 466beafadb37011fe273de8810ab0012e92a1fd8)
2009-11-24 11:09:01 +10:30
Rusty Russell
1d68bb35b2 eventscript: typo cleanups
1) ctdb_event_script_v doesn't take varargs.  ctdb_run_event_script is
   a better name, and fix comment.
2) Fix indentation on allowed_scripts.
3) Comment on run_eventscripts_callback is wrong; it's the callback
   for any ctdb forced event.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit e7d57d7ae678b24dab3364a348838c6a3398942c)
2009-11-24 11:08:39 +10:30
Rusty Russell
ab675516cc eventscript: fix bug in timeouts on forced eventscripts. Again.
In 15bc66ae801b0c69, Ronnie fixed a double-free race.  The problem was that
ctdb_run_eventscripts() hands a context to ctdb_event_script_callback() to
hang its data off, which gets freed in the callback.  This particularly
hurt in ctdb_event_script_timeout.

There's nothing wrong with this, but obviously we should make the callback
call last of all.  At the time, ctdb_event_script_timeout() carefully
extracted everything from the struct ctdb_event_script_state before
calling ->callback.

This was cleaned up in 64da4402c6ad485f (Ronnie again), and now state
was referred to after the callback again.  But the same change introduced
a direct use-after-free bug which caused an occasional oops.

So in our last episode (eda052101728cf92) Volker fixed this, and Michael
committed it.

But we still have the double free bug which 15bc66ae801b0c69 was supposed
to fix!  Let's try to fix this in a more permanent way, but always doing
the callback from the destructor.  This means we need to hold the status,
and don't send the KILL signal if ->child is set to 0.

Finally, add a comment about freeing ourselves in run_eventscripts_callback
and the structure definition.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit b90bdb07c1f6913ddbf11bde9684bdc8af61c549)
2009-11-24 11:06:53 +10:30
Rusty Russell
0339a83897 eventscript: fix bug in timeouts on forced eventscripts. Again.
In 15bc66ae801b0c69, Ronnie fixed a double-free race.  The problem was that
ctdb_run_eventscripts() hands a context to ctdb_event_script_callback() to
hang its data off, which gets freed in the callback.  This particularly
hurt in ctdb_event_script_timeout.

There's nothing wrong with this, but obviously we should make the callback
call last of all.  At the time, ctdb_event_script_timeout() carefully
extracted everything from the struct ctdb_event_script_state before
calling ->callback.

This was cleaned up in 64da4402c6ad485f (Ronnie again), and now state
was referred to after the callback again.  But the same change introduced
a direct use-after-free bug which caused an occasional oops.

So in our last episode (eda052101728cf92) Volker fixed this, and Michael
committed it.

But we still have the double free bug which 15bc66ae801b0c69 was supposed
to fix!  Let's try to fix this in a more permanent way, but always doing
the callback from the destructor.  This means we need to hold the status,
and don't send the KILL signal if ->child is set to 0.

Finally, add a comment about freeing ourselves in run_eventscripts_callback
and the structure definition.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 20b15de068d042b292725945927ceda1b01d07c0)
2009-11-24 11:06:53 +10:30
Rusty Russell
8723045c61 eventscript: clean up forked handler event code
Write the whole int through the pipe, rather than quietly cutting it
off.  Also, use -2 as the result if the read fails; -1 comes from many
paths if the child fails before running the script.

Add a comment about why we don't need to check the write.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit 6804f880436645b52c09a78fa300377fa8058d0e)
2009-11-24 11:00:13 +10:30
Ronnie Sahlberg
e6b69fa760 rework and simplify the eventscript handling
This version has no trailing whitespace, and fixed 


(This used to be ctdb commit defbe318152fc479e8076ad70433cdb4971951af)
2009-11-25 11:00:11 +10:30
Rusty Russell
b320d434b2 eventscript: clean up forked handler event code
Write the whole int through the pipe, rather than quietly cutting it
off.  Also, use -2 as the result if the read fails; -1 comes from many
paths if the child fails before running the script.

Add a comment about why we don't need to check the write.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


(This used to be ctdb commit c715746c2f40eb9b21dbf011d16f1f1b0b53fdf9)
2009-11-24 11:00:13 +10:30
Ronnie Sahlberg
a3d072049e reduce the log level for three vacuuming related log messages
(This used to be ctdb commit fbc453733d53359b9eba34a7ca9123237a7ecca5)
2009-11-24 09:27:22 +11:00
Ronnie Sahlberg
eb3b787394 rework and simplify the eventscript handling
(This used to be ctdb commit c5f798116bf3b7954e23c7267b056ee1f5560f45)
2009-11-24 07:40:51 +11:00
Martin Schwenke
d595f41f38 More eventscript cleanups. Initial smoke testing seems OK.
Apart from lots of cleanup work, this also fixes a bug where the share
checks didn't used to cope with directory names containing spaces.
The previous commit also loaded the config incorrectly.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 35a60a63a9b5c7d98dde514ae552239506b691c9)
2009-11-20 16:45:36 +11:00
Martin Schwenke
a4a048b5cd Now vaguely tested initscript updates.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f1e350f9edb74cc44b6c5be4c062fd93e98ba8c4)
2009-11-19 16:48:19 +11:00
Martin Schwenke
ee513c1ba2 More untested eventscript factorisation.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit ac655b0a65b32d809d47fec9821f7f31bb2fe2a7)
2009-11-19 15:00:17 +11:00
Martin Schwenke
4ea6069de4 Test suite: Make the CIFS tickle test wait until it sees the required tickle.
The test depended on the exit code of "ctdb gettickles", which always
succeeds.  This change wraps the command in a function that checks
whether the tickle we're interested in is registered.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c4b05a731e1bee8f5b46529773a4f5389b2b6064)
2009-11-19 14:54:05 +11:00
Ronnie Sahlberg
894a2f9c0b new version 1.0.105
(This used to be ctdb commit 5fdf842db09cd806248cdbdce2270f39ed213872)
2009-11-19 11:08:14 +11:00
Ronnie Sahlberg
ae209c74c8 dont reset the event script context everytime we start a new "ctdb eventscript ..."
command.
Use the existing context used for non-monitor events

Multiple concurrent uses of "ctdb eventscript ..." could otherwise lead to a SEGV

(This used to be ctdb commit 80a8d728e9680040e00d24361dfc9367dd372a56)
2009-11-19 11:03:51 +11:00
Ronnie Sahlberg
cc2d81a77c make the ringbuffer logging more efficient and marshall the data by writing to a tmpfile instead of continously talloc resizing a blob
(This used to be ctdb commit 6427f0b68d60b556a023f64e15e156000ba6f943)
2009-11-18 19:10:50 +11:00
Ronnie Sahlberg
bc2675119d add an in memory ringbuffer where we store the last 500000 log entries regardless of log level.
add commandt to extract this in memory buffer and to clear it

(This used to be ctdb commit 29d2ee8d9c6c6f36b2334480f646d6db209f370e)
2009-11-18 12:44:18 +11:00
Ronnie Sahlberg
24c593d21f create a new event context for the syslog daemon
(This used to be ctdb commit 354c0edacf2d6cec5b295e139d4fec618bad1b06)
2009-11-17 12:07:10 +11:00
Ronnie Sahlberg
61de178e0a set up a pipe betweent he main daemon and the child we use for syslogling so that we can clean up the childprocess when we stop ctdbd
(This used to be ctdb commit cb8df973ccd446d87fbdd9a27843e54841ba5d89)
2009-11-16 15:17:32 +11:00
Martin Schwenke
73cb65bf1a Eventscripts: Untested factorisations and introduction of status event.
This is the first stage of an experimental change to eventscripts.
Ronnie and I did a few hours of factorisation of 40.vsftpd and applied
many of the changes to 41.httpd.  Other eventscripts were also
modified.

At this stage this is completely untested.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 364e70b763f0ccd7714d15723ad3ea4d7e2968a1)
2009-11-13 18:28:25 +11:00
Ronnie Sahlberg
93d902e8f7 test of a change to make ctdbd use "status" event instead of the "monitor" event.
This allows running the actual monitoring asynchronously from ctdbd
and only using "status" to pick up the actual results.

(This used to be ctdb commit 1908bac812650ca25151051f5d86815e0b8ed319)
2009-11-13 12:37:55 +11:00
Ronnie Sahlberg
2861bbdd5a Merge commit 'martins/master'
(This used to be ctdb commit b6bde176af69354ccfb00e6a3169f6b355a59d15)
2009-11-13 12:25:31 +11:00
Martin Schwenke
386d23757b Test suite: Fix the NFS and CIFS tickle tests.
The NFS test sleeps for MonitorInterval to give CTDB time to record an
NFS tickle.  However, this isn't always long enough.  This changes the
test to wait until a monitor event has actually occurred.

The CIFS test assumes that Samba is able to register a tickle with
CTDB before it notices that netstat has registered the tickle and can
use onnode to ask CTDB about it.  That is an incorrect assumption -
sometimes we can get to the point of asking CTDB about the tickle
before Samba and CTDB have processed it.  This adds a timeout loop
that makes the CIFS test wait until the tickle has been registered or
fail after 10 seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 20a9d35933d89dc7eb710075f360686a49d78609)
2009-11-13 09:44:34 +11:00
Martin Schwenke
9dabb86f3f Merge commit 'origin/master'
(This used to be ctdb commit ffb911896704ddf6bd5a66e43ba2ae8c382e68de)
2009-11-11 12:16:30 +11:00
Mathieu Parent
2a66b7dae4 Fix bashism in events.d/11.natgw
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 6ccb495d1110157c06596763c7e252f3182c251e)
2009-11-10 12:07:30 +01:00
Ronnie Sahlberg
14a6592511 version 1.0.104
(This used to be ctdb commit 5e13a25df5ccf184bd48595c99765a592bbc5969)
2009-11-06 11:16:05 +11:00
Ronnie Sahlberg
3cbaf935af sugegstion from metze,
use killtcp and kill both directions of the nfs connections.
we used to kill only one direction since the other direction was unkillble
but recent kernels allow us to kill both

(This used to be ctdb commit 8001ae580bcc28d45f6026b529d7ffc247cbba34)
2009-11-06 09:54:03 +11:00
Ronnie Sahlberg
f88fbb5f1e suggestion from Christian,
dont allow UNHEALTHY nodes to become natgw master, unless all nodes
are unhealthy

(This used to be ctdb commit e8e7129ff1371065fbd75e1aea844d6d04a96fa9)
2009-11-06 08:19:32 +11:00
Volker Lendecke
1fa1830f81 Fix a segfault in the eventscript timeout handler.
The state was freed too early.

Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit eda052101728cf922ce892e3c53b4f37e7ceac42)
2009-11-05 11:13:53 +01:00
Michael Adam
85a4d9a943 ctdb.sysconfig: add a comment section about CTDB_RUN_TIMEOUT_MONITOR
Michael

(This used to be ctdb commit b7dc1e0720991cc65353e07cf87608acea21ba27)
2009-11-05 11:13:53 +01:00
Michael Adam
95333e0ee7 Add a 99.timeout event script to trigger monitor timeouts.
This just sleeps for twice the value of EventScriptTimeout
in the monitor action. It is not run by default, but
can be activated by setting CTDB_RUN_TIMEOUT_MONITOR
in /etc/sysconfig/ctdb .

Michael

(This used to be ctdb commit 1a3ecdee85b82bb3234a92ae6bcdeb92238eb7ee)
2009-11-05 11:13:47 +01:00
Ronnie Sahlberg
d8f7fd88ac dont use the pointer after it has been talloc_free()d.
(This used to be ctdb commit 1cbf06a126621b3e932925cdad2ef9c009f93d4e)
2009-11-05 16:07:23 +11:00
Ronnie Sahlberg
0d3bff5fa6 From Rusty
It's much nicer for post-mortem debugging to have a body to examine.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

(This used to be ctdb commit 058e21d96c3c02759833fd5ddfe7b43e6a5f5740)
2009-11-05 15:57:46 +11:00
Ronnie Sahlberg
c915f2e5d5 add an extra test for the bond devices and check that there is an active slave.
this to handle the case where all links do have a physical layer, but where all slaves have been disabled using ifdown

(This used to be ctdb commit bf50709630df000583f2b0ef0edc177c01d60eaf)
2009-11-05 12:12:06 +11:00
Ronnie Sahlberg
2501638e15 dont verify winbindd is running properly at startup
(This used to be ctdb commit 9e1b99221c8f257129641f6eda2795537b7ce9de)
2009-11-04 07:50:26 +11:00
Ronnie Sahlberg
666d1d019b new version 1.0.103
(This used to be ctdb commit 020e2e30e56b9675f345ee62d6bf585396208059)
2009-11-03 11:46:37 +11:00
Ronnie Sahlberg
4bf4e15379 move the check to skip vacuuming on persistent database to the ctdb_vacuuming_init() function
(This used to be ctdb commit fb83dba255fc91413a475b273e374e0c4d538137)
2009-11-03 10:48:27 +11:00
Michael Adam
e38dda00e7 packaging: use githash in rpm release by default.
setting USE_GITHASH=no in the environment makes
makerpms.sh omit the git hash

Michael

(This used to be ctdb commit 209ff041596e39688186c99995863ed3e816b8e4)
2009-11-03 00:16:28 +01:00
Michael Adam
fe9929165f server: disable vacuuming for persistent tdbs.
The vacuum process treats persistent databases the same as
non-persistent and thus ignores the extra state for transactions.
This way, it breaks the api-level transactions.

Michael

(This used to be ctdb commit f98fefbc566eefbfcc660646af6e25256ab82b13)
2009-11-03 00:16:28 +01:00
Michael Adam
c532347a45 client: randomize the transaction_start retry loop:
instead of sleeping 1 second, sleep between 1 and 100 milliseconds

Michael

(This used to be ctdb commit a5d90d8ed8b44355c4ffb9c32ded772025fcc174)
2009-10-30 22:02:21 +11:00
Michael Adam
de875c7eec Revert "dont exit on a commit failure"
This reverts commit 4e9a3a5dc232bac12ab387ea0cf4f1b279bed5c1.

Transaction commit should not be allowed to fail.
This is a real error.

Michael

(This used to be ctdb commit 825c506da76d7afd0714b75b8c8727874183a618)
2009-10-30 22:01:53 +11:00
Michael Adam
118185670d client: fix a race in the local race condition fix in transaction_start
The gap that remained is between checking whether a transaction commit
is in progress and taking the lock. Now we first take the lock and then
check whether a transaction commit is in progress. If so, we release the
lock, wait for one second and retry.

Michael

(This used to be ctdb commit b95524c08bf12914120cb6c818ecc1c99738fe37)
2009-10-30 22:01:16 +11:00
Michael Adam
c2855a11a8 client: add a debug message when a transaction_commit needs to be retried
Michael

(This used to be ctdb commit 9e4902c7d3ad1329c296f4196fcb1396f2a7a6a0)
2009-10-30 22:00:42 +11:00
Michael Adam
5fa3a2c96a packaging(RPM): don't touch the run levels in ctdb install/udpate.
We should really leave it up to the administrator to decide
whether ctdb should be started automatically at boot-time.

Michael

(This used to be ctdb commit c1d8496f9fd5e8046f3d990264258dfb054f3b32)
2009-10-30 21:42:34 +11:00
Ronnie Sahlberg
e33722a569 start the syslog child a little later, after we have forked and detached from the local shell
(This used to be ctdb commit 9ffd54b73c0d64b67e8e736d7cb54490e77ffa78)
2009-10-30 19:39:11 +11:00
Ronnie Sahlberg
5d73f19418 create a child process to write to syslog.
use a udp socket on the ctdbd port to send messages to teh syslog child process for loggign.

we need this when syslog becomes "slow",   like very slow, and on boxes where syslog is limited to 100 lines per second and starts to block after that

(This used to be ctdb commit 1446f4c247310e2ff2d522055bd8927d1a78d017)
2009-10-30 18:53:17 +11:00
Michael Adam
673a8588b1 server: fix debug message in trans2_commit (refusing persistent store during transaction)
log the right db_id
also log the client_id

Michael

(This used to be ctdb commit 48ac5c77698ab7a28d24629cc8a6985011c5d14d)
2009-10-30 09:29:25 +11:00
Michael Adam
45c17515c3 client: log db_id as 8-digit hex in ctdb_transaction_fetch_start()
Michael

(This used to be ctdb commit d7b9babda2f7c7f7b95ee19ec75c37200816c6ef)
2009-10-30 09:28:49 +11:00
Michael Adam
1de0c6f807 server: uniformly log db and client ids as 8-digit hex numbers in trans2_commit
Michael

(This used to be ctdb commit 2febdd23f754a2d4699bed36b941442ab362a376)
2009-10-30 09:28:06 +11:00
Michael Adam
7384dfe4a9 server: line-wrap a debug statement in trans2_commit
Michael

(This used to be ctdb commit 3be446434adb0f3095ac0ef4b7c4a6258780b863)
2009-10-30 09:27:33 +11:00
Michael Adam
7bfa959a86 server: output client_id in some debug messages in trans2_commit
Michael

(This used to be ctdb commit 11fefd02e6c9531ffb28b9e6acaf42ba39757d87)
2009-10-30 09:26:51 +11:00
Michael Adam
4d073bd779 server: fix a debug message in trans2_commit - log the correct db_id
Michael

(This used to be ctdb commit ab9657b5a66d5665e6c5fd1bf8eb4074a3bffeec)
2009-10-30 09:26:16 +11:00
Michael Adam
dca16d5f64 server: extend a debug message in ctdb_control_trans2_error()
Michael

(This used to be ctdb commit 0fb9573d1c838b436ab9be83e197b68f35f94acb)
2009-10-30 09:24:17 +11:00
Michael Adam
2187e6c379 server: add positive debug statements to trans2_commit and trans2_finished
When the operation completed / started successfully.

Michael

(This used to be ctdb commit 0df012d58eb83195ea0365be19e0566dbc394a66)
2009-10-30 09:23:29 +11:00
Michael Adam
361aec199e client: improve "control timed out" debug message
* add __location__
* wrap overly long line
* print unsigned ints as unsigned (reqid, opcode, destnode)

Michael

(This used to be ctdb commit 6b47ea111867c845974aa2687a658ebca2854816)
2009-10-30 09:22:52 +11:00
Michael Adam
0113744fec server: trans2_active: don't report a transaction active on the node that performs the transaction
Otherwise a node can lock itself out, e.g. when a commit control times out...

Michael

(This used to be ctdb commit cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2)
2009-10-30 09:22:18 +11:00
Ronnie Sahlberg
784a89ec62 new version 1.0.102
(This used to be ctdb commit 4892222ffb255dccd8ced1cb047f199386bb3e98)
2009-10-29 13:49:27 +11:00
Wolfgang Mueller-Friedt
9713b8ea9a ensure tdb names end with .tdb. and any number of digits
(This used to be ctdb commit 8ab1349feb64a91cb500c130ea299e2182491f06)
2009-10-29 13:46:37 +11:00
Wolfgang Mueller-Friedt
2c137b7030 vacuuming needed additional check before getting rid of the record; there is a gap between selecting the records and deleting them, therefore we have to check if the records still can be deleted when we actually are about to delete them
(This used to be ctdb commit a6fbc65aca35c41c428a82d7402e43c6eaac1d6e)
2009-10-29 13:45:17 +11:00
Ronnie Sahlberg
f5e90ec3b5 Revert "From Wolfgang M."
This reverts commit 5b70fa8cfd5916d3c212823ad5cc1b251ae175ed.

(This used to be ctdb commit 363e7e939ad46b3f75c83c30d4163d63876c2456)
2009-10-29 13:44:12 +11:00
Ronnie Sahlberg
9e235af3a2 make the error logged when winbindd fails to access the dc during startup more scary and easier to spot in the logs
(This used to be ctdb commit 0c9b0466fd87b3f1e5d53f867c863217802ac43b)
2009-10-29 11:54:24 +11:00
Ronnie Sahlberg
fcd2ebc32b update the uptime command to indicate that time since last is either from alst recovery or from last failover
(This used to be ctdb commit 467da12a785ba3367ed9cbdf79440394e9703289)
2009-10-29 10:58:14 +11:00
Ronnie Sahlberg
023d09cd38 Revert "update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover."
This reverts commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36.

(This used to be ctdb commit cb36bbb5418290e8e5b770d2d836285b15da2a6f)
2009-10-29 10:49:00 +11:00
Ronnie Sahlberg
a4b8a17b26 update the manpage for "update" to indicate the "time since last" indicates
the time since the last recovery OR failover

(This used to be ctdb commit 22712c577f64ec84851b4addcf4a46c7e99e0662)
2009-10-29 10:32:28 +11:00
Ronnie Sahlberg
279b7ca564 update the "uptime" command to indicate the "time since last" is the time since the last recovery OR failover.
(This used to be ctdb commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36)
2009-10-29 10:37:10 +11:00
Michael Adam
2419eab0d9 ctdb_client: reformat a comment slightly to enhance clearness.
Michael

(This used to be ctdb commit 9560f8b7fe0f7ee0386a87c2653333071050fe4b)
2009-10-29 10:15:54 +11:00
Michael Adam
5d579cf665 client: fix race condition with concurrent transactions on the same node.
In ctdb_transaction_commit(), when the trans2_commit control fails, there
is a race condition in the 1 second sleep between the local transaction_cancel
and the call to ctdb_replay_transaction(): The database is not locked, and
neither is the transaction_lock record. So another client can start and possibly
complete a new transaction in this gap, but only on the same node: The locking
of the transaction_lock record on a different node which involves migration of
the record to the other node has been disabled by introduction of the
transaction_active flag on the db which closes precisely this gap from the start
of the commit until the call to TRANS2_FINISH or TRANS2_ERROR.
But this mechanism does not cover the case where a process on the same node
tries to start a transaction: There is no obstacle to locking the transaction_lock
record because the record does not need to be migrated.

This commit closes this race condition in ctdb_transaction_fetch_start()
by using the new ctdb_ctrl_transaction_active() call to ask the local
ctdb daemon whether it has a transaction running on the database.
If so, the check is repeated until the running transaction is done.

This does introduce an additional call to the local ctdbd when starting
transactions, but it does close the (hopefully) last race condition.

Michael

(This used to be ctdb commit 02ee9dfd3c6b09f5c5172a7e38738c20b7f0aecd)
2009-10-29 10:15:21 +11:00
Michael Adam
953ccee5c5 client: add ctdb_ctrl_transaction_active() which calls out to CTDB_TRANS2_ACTIVE
Michael

(This used to be ctdb commit 813cfd7c625ac8af4ef169cc92fb6d69f66004c9)
2009-10-29 10:15:00 +11:00
Michael Adam
abac42ca34 server: add a new ctdb control CTDB_TRANS2_ACTIVE
This aske the daemon wheter a transaction is currently active on a
given DB on that node. More precisely this asks for the transaction_active
flag in the ctdb_db_context that is set in the CTDB_TRANS2_COMMIT
control and cleared in the CTDB_TRANS2_ERROR or CTDB_TRANS2_FINISHED controls.

This will be useful for fixing race conditions in the transaction code.

Michael

(This used to be ctdb commit 8d430ae6968dfe566614379436fc3c56003fcd88)
2009-10-29 10:14:30 +11:00
Ronnie Sahlberg
019f3c930e version 1.0.101
(This used to be ctdb commit 47b67077bdfa64938bb0fa6d1ca8f56fbd5c960e)
2009-10-28 17:42:01 +11:00
Ronnie Sahlberg
d379b30182 create a separate context for non-monitor eventscripts so they dont collide
(This used to be ctdb commit 325de818f88f339a16dc4544e899a2d735933c44)
2009-10-28 17:35:15 +11:00
Ronnie Sahlberg
f8a8c0d6e4 return 0 in the event script callback if it was aborted by a different script
(This used to be ctdb commit 8d5cb2586a1d5a0255cc18295430927b914d4527)
2009-10-28 16:40:31 +11:00
Ronnie Sahlberg
d82fdcb56f new version 1.0.100
(This used to be ctdb commit fa34e8a5d588026029dca949151697817fe7f127)
2009-10-28 16:18:28 +11:00
Ronnie Sahlberg
e07ca41886 change the eventscript handling to allow EventScriptTimeout for each individual script isntead of for the entire set of scripts
restructure the talloc hierarchy to allow this

(This used to be ctdb commit 64da4402c6ad485f1d0a604878a7b0c01a0ea5f0)
2009-10-28 16:11:54 +11:00
Martin Schwenke
8767c894a0 Test suite: Regression fix - wait_until should not run command in sub-shell.
Commit 25e82a8a667a54c6921ef076c63fdd738dd75d19 changed wait_until()
to protect the command it runs from "set -e" by running it in a
subshell.  This breaks uses where the command is expected to set
global variables.  For example, wait_until_get_src_socket lost the
value of $out from its call to get_src_socket().

The fix is to not be lazy and use a sub-shell!

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 39642e745254d93d74dde907787503854fe6ca4a)
2009-10-28 13:02:18 +11:00
Ronnie Sahlberg
3526bc830d Enhance the logging fromeventscripts.
When a single script is finished, also log the name of the script, the duration it took and the return status.

In the loop where we signal back to the main daemon that the script finished, do this once every 100ms instead of once every 1 second

(This used to be ctdb commit 6a1f7a7b1b3a0b8f89998db8fdad83bbb4e9b5a5)
2009-10-28 09:07:43 +11:00
Ronnie Sahlberg
0588b5f9c5 add a check that winbind can actually talk to teh dc during the startup event
and refuse to start up if it can not

(This used to be ctdb commit 4037b6e73a819a8e2463dfe0959b42875e05e106)
2009-10-27 15:45:03 +11:00
Ronnie Sahlberg
d1bf89a617 temporarily try allowing clients to attach to databases even if the node is banned/stopped or inactive in any other way.
(This used to be ctdb commit 227fe99f105bdc3a4f1000f238cbe3adeb3f22f0)
2009-10-27 15:17:45 +11:00
Ronnie Sahlberg
1d7681709b dont run the monitor event so frequently after a event has failed.
use _exit() instead of exit() when terminating an eventscript.

(This used to be ctdb commit cc30ee2f4f33cb75b2be980c2d4dff6c7c23852f)
2009-10-27 13:51:45 +11:00
Ronnie Sahlberg
4d40b86805 for debugging
add a global variable holding the pid of the main daemon.
change the tracking of time() in the event loop to only check/warn when called from the main daemon

(This used to be ctdb commit a10fc51f4c30e85ada6d4b7347b0f9a8ebc76637)
2009-10-27 13:18:52 +11:00
Stefan Metzmacher
3d713d9e53 ctdb_diagnostics: don't use hardcoded path to iptables
All event scripts use only the relative path, so we should
here.

Also PATH includes /sbin and /usr/sbin...

metze

(This used to be ctdb commit 20678e1506db1f96b58c326ee91339e797c07c22)
2009-10-26 14:23:09 +11:00
Stefan Metzmacher
1c6829f3c2 ctdb_client: fix DEBUG statement in ctdb_ctrl_modflags()
metze

(This used to be ctdb commit a244b75ee49556b0ff51e254cc812594ee3b23a7)
2009-10-26 14:22:07 +11:00
Stefan Metzmacher
198866d82d server: if takeover runs when the recovery master becomes unhealthy
The problem was this:

When the monitor event fails, the node->flags get updated,
and an update (containing the old and new flags) is sent to
the recovery master.

If the recovery master sends the update to itself (the same process),
it was compairing the node->flags variable with the received new flags.
This check always found both flag values to be equal
and never sets the rec->need_takeover_run variable to true.

There were two problem, first the push_flags_handler() function
didn't pass the received old flags.

And the ctdb_control_modflags() function ignored the received old flags.

metze

(This used to be ctdb commit 8ec633b64a05a2d903c2b9639909f15f6375548f)
2009-10-26 14:21:45 +11:00
Stefan Metzmacher
7a616a0d7b server: print out the full 64-bit srvid on 32-bit hosts
metze

(This used to be ctdb commit 440e870d61267054b24404bcb69e599226353949)
2009-10-26 14:20:52 +11:00
Stefan Metzmacher
ee97e2676d tcp: don't log an error when we succefully bind to the desired address
metze

(This used to be ctdb commit 752a9c81de97be509de7e7feddde749cc5ee22a8)
2009-10-26 14:20:23 +11:00
Ronnie Sahlberg
299b027b8c patch the event loop so we read the current time every iteration.
log an error if the clock jumps backwards
also log an error if the clock jumps >5 seconds forward (we assume here we will get at least one event every 5 seconds)

(This used to be ctdb commit 11193e1e192bee6f579bdf1303153571a82711d7)
2009-10-26 13:20:35 +11:00
Ronnie Sahlberg
8aacfa348d Suggestion from Volker,
make ctdb_queue_length() cheaper by using a counter variable instead of counting the number of packets each time.

(This used to be ctdb commit 331c6e3afd96d8b5e191153a631efdbdabb6ea33)
2009-10-26 12:20:52 +11:00
Ronnie Sahlberg
c36fa583f3 disabel the multipath eventscript by default
(This used to be ctdb commit e79c3bcead7bd4bfb74d0aec81908da71551c107)
2009-10-26 10:22:00 +11:00
Ronnie Sahlberg
9db2a5ca05 update the manpage for ctdb setreclock
(This used to be ctdb commit ab4a6a58fb002ec29c19d167800e47987b023fe4)
2009-10-26 10:11:00 +11:00
Ronnie Sahlberg
2d06e9d252 automatically re-activate the reclock file check if we set the reclock file to something
(This used to be ctdb commit db250cad7c92c1cc0a690725a4e39531a2e1b7fd)
2009-10-26 10:13:20 +11:00
Ronnie Sahlberg
5aaa15fdb2 lower the log level of a debug message
(This used to be ctdb commit 496dc2e80b714811c6e69dc928deaad61cf603b1)
2009-10-26 09:35:18 +11:00
Ronnie Sahlberg
86d1b4c465 Add a mechanism where we can register notifications to be sent out to a SRVID when the client disconnects.
The way to use this is from a client to :
1, first create a message handle and bind it to a SRVID
   A special prefix for the srvid space has been set aside for samba :
   Only samba is allowed to use srvid's with the top 32 bits set like this.
   The lower 32 bits are for samba to use internally.

2, register a "notification" using the new control :
                    CTDB_CONTROL_REGISTER_NOTIFY         = 114,
   This control takes as indata a structure like this :
struct ctdb_client_notify_register {
        uint64_t srvid;
        uint32_t len;
        uint8_t notify_data[1];
};

srvid is the srvid used in the space set aside above.
len and notify_data is an arbitrary blob.
When notifications are later sent out to all clients, this is the payload of that notification message.

If a client has registered with control 114 and then disconnects from ctdbd, ctdbd will broadcast a message to that srvid to all nodes/listeners in the cluster.

A client can resister itself with as many different srvid's it want, but this is handled through a linked list from the client structure so it mainly designed for "few notifications per client".

3, a client that no longer wants to have a notification set up can deregister using control
                    CTDB_CONTROL_DEREGISTER_NOTIFY       = 115,
which takes this as arguments :
struct ctdb_client_notify_deregister {
        uint64_t srvid;
};

When a client deregisters, there will no longer be sent a message to all other clients when this client disconnects from ctdbd.

(This used to be ctdb commit f1b6ee4a55cdca60f93d992f0431d91bf301af2c)
2009-10-23 15:24:51 +11:00
Ronnie Sahlberg
c61c655769 when scripts timeout, log pstree to a file in /tmp and just log the filename in the messages file
(This used to be ctdb commit 0785afba8e5cd501b9e0ecb4a6a44edf43b57ab0)
2009-10-23 13:55:21 +11:00
Ronnie Sahlberg
3c9b43531a set the eventscripts to timeout after 20 seconds
change the ban count to 10 failures before we ban by default

(This used to be ctdb commit 38d7487bc68c8cf85980004aceeef24ae32d6f36)
2009-10-23 13:54:45 +11:00
Ronnie Sahlberg
65757fe1d6 Merge commit 'martins/master'
(This used to be ctdb commit 514a60c57557042e463efeff53dd11b9fec40561)
2009-10-23 10:43:13 +11:00
Ronnie Sahlberg
42718a8842 new version 1.0.99
(This used to be ctdb commit 14fca8383b6b1da49278a9181a975543b956161b)
2009-10-22 18:16:33 +11:00
Martin Schwenke
69cca03851 Merge commit 'origin/master'
(This used to be ctdb commit f3e09f2cfd33e79e69fc8c84ce4781a31a7a0437)
2009-10-22 17:48:09 +11:00
Martin Schwenke
a128b7e3bb Document onnode -n and -f options.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 431f79f7c9038ebd95d27c2465207ca40b8f4f23)
2009-10-22 17:47:10 +11:00
Ronnie Sahlberg
e627fae600 if a lock wait child died/finished, we could have released the lockwait handle and set it to NULL before we call the destructors for releaseing the waiters.
The waiters reference the locakwait handle in order to remove itself from the li
nked list which caused a SEGV.

We dont actually need to remove ourselves from this list here since
if the parent freeze_handle holding the list is freed, then all waiters are rele
ased as well, and the only place we actually need to relink the waiter is in ctd
b_freeze_lock_handler, where we want to respond back to the clients and release
the waiters  but we still want to keep the freeze_handle hanging around.

(This used to be ctdb commit e01ab46bafad09a5e320d420734db129d35863bc)
2009-10-22 13:41:28 +11:00
Ronnie Sahlberg
902c476c03 From Volker L
Fix some warnings  and an incorrect check for a talloc failure

(This used to be ctdb commit 27296a47b3d057a6729287acf128b2b67775ecde)
2009-10-22 12:19:40 +11:00
Ronnie Sahlberg
831f9e05a6 From Wolfgang M.
With the new vacuuming code, dont treat an invalid dmaster as fatal. Let it update to the new value insetad.

(This used to be ctdb commit 5b70fa8cfd5916d3c212823ad5cc1b251ae175ed)
2009-10-22 07:58:44 +11:00