summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | Add a double linked list to the ctdb_context to store a mapping between ↵Ronnie Sahlberg2009-12-022-2/+37
| | | | | | | | | | | | | | | | | | 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)
* | Use the PID we pick up from the domain socket when a client connectsRonnie Sahlberg2009-12-021-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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)
* | version 1.0.107Ronnie Sahlberg2009-12-021-1/+5
| | | | | | | | (This used to be ctdb commit 22f00368b4cb3a6bfb92033a7dbe693d31b41a54)
* | ctdb_io: fix use-after-free on invalid packetsRusty Russell2009-12-021-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | version 1.0.106Ronnie Sahlberg2009-12-021-1/+11
| | | | | | | | (This used to be ctdb commit b5a21fd39269a6e2a9d1c8182dd42a1773ccbb3f)
* | packaging:maketarball.sh: add a DEBIAN_MODE to the tarball creationMichael Adam2009-12-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* | configure:maketarball.sh: call autogen.sh and include configure in the tarballMichael Adam2009-12-011-4/+39
| | | | | | | | | | | | Michael (This used to be ctdb commit bc8aee079e09164e06533a1474f5e9d899795933)
* | packaging:maketarball.sh: create the specfile from the ctdb.spec.inMichael Adam2009-12-011-1/+12
| | | | | | | | | | | | Michael (This used to be ctdb commit bb8d02abd88899d259085b9b23fa52accb222be9)
* | when we detect a ip-allocation mismatch, just force a new ip reassignmentRonnie Sahlberg2009-12-011-25/+26
| | | | | | | | | | | | instead of a full blown recovery (This used to be ctdb commit 4f50aa8bb8be544058523f2f544109a26c2b3b51)
* | When starting up ctdbd, wait until all initial recoveries have finishedRonnie Sahlberg2009-12-011-5/+47
| | | | | | | | | | | | | | | | 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)
* | Merge commit 'martins/status-test-2'Ronnie Sahlberg2009-12-0126-792/+842
|\| | | | | | | | | | | | | | | Conflicts: server/eventscript.c (This used to be ctdb commit e9b3477a5b9a2eff18f727e7d59338bfb5214793)
| * Event scripts: functions file now intercepts status and setstatus.Martin Schwenke2009-11-271-0/+11
| | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a1f37fdc5217e57d2d643d77a811afca747685e0)
| * remove a stray ) so we compileRonnie Sahlberg2009-11-271-1/+1
| | | | | | | | (This used to be ctdb commit 16db4882635d84b8410a77e2ea8b08d0a257b0ab)
| * dont use talloc_steal() on a object that is already a child of ctdb.Ronnie Sahlberg2009-11-271-1/+1
| | | | | | | | (This used to be ctdb commit 50c2caed57c0520f506eaaeeb0bba2c272da6ef6)
| * Merge commit 'martins/status-test' into status-test-2Ronnie Sahlberg2009-11-271-0/+1
| |\ | | | | | | | | | (This used to be ctdb commit 937823cc73eb098230acff4b1583f6d01f26c21a)
| | * Merge commit 'martins-svart/status-test-2' into status-testMartin Schwenke2009-11-271-0/+1
| | |\ | | | | | | | | | | | | (This used to be ctdb commit 0e6c06ac38fd82adf124d111717502055501974a)
| | | * Event script infrastructure: add reload event to check_options().Martin Schwenke2009-11-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c278c798d41a35f58ca81f8f0e08e4dab51eba9b)
| * | | Merge commit 'martins/status-test' into status-test-2Ronnie Sahlberg2009-11-265-21/+41
| |\| | | | | | | | | | | | | | (This used to be ctdb commit 28d0648725e7de4e4d0e8569e3fbfb0fa1d7f934)
| | * | Merge commit 'martins-svart/status-test-2' into status-testMartin Schwenke2009-11-265-21/+41
| | |\| | | | | | | | | | | | | (This used to be ctdb commit 143f1fa3cc4588505e3992c601153ea08be8432d)
| | | * Add flag to ctdb_event_script_callback indicating when called by client.Martin Schwenke2009-11-265-21/+41
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a1d654a982ca56fade82552f4e6b5586236d3233)
| * | | resolve some conflicts from merging from martins branchRonnie Sahlberg2009-11-261-26/+0
| |/ / | | | | | | | | | (This used to be ctdb commit d3e7407dc9854ec358d081777c5450ec68b17862)
| * | Merge commit 'martins-svart/status-test-2' into status-testMartin Schwenke2009-11-263-8/+37
| |\| | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit a2830594ebeb54eb51ff90999cb12370aeec6e8b)
| | * Event scripts: use $script_name rather than $service name for status.Martin Schwenke2009-11-251-7/+8
| | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 517e9d9b188b18dffc712a8fecddb41540d27b8d)
| | * Event scripts: Respect CTDB_MANAGES_NFS and add function log_status_cat.Martin Schwenke2009-11-251-0/+6
| | | | | | | | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 5d97c07be13a8209a81dfc8f73e49371949e4dc3)
| | * More eventscript cleanups. Initial smoke testing seems OK.Martin Schwenke2009-11-253-133/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: check that ctdb forced script events correctRusty Russell2009-11-252-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: check that internal script events are being invoked correctlyRusty Russell2009-11-241-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: remove call name from state->optionsRusty Russell2009-11-241-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: put call type into state struct.Rusty Russell2009-11-241-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: introduce enum for different event script calls.Rusty Russell2009-11-247-23/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: put timeout inside ctdb_event_script_callback_vRusty Russell2009-11-245-23/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: cleanup ctdb_event_script_vRusty Russell2009-11-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: fix bug in timeouts on forced eventscripts. Again.Rusty Russell2009-11-241-40/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * eventscript: clean up forked handler event codeRusty Russell2009-11-241-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * rework and simplify the eventscript handlingRonnie Sahlberg2009-11-252-153/+108
| | | | | | | | | | | | | | | | | | | | | This version has no trailing whitespace, and fixed (This used to be ctdb commit defbe318152fc479e8076ad70433cdb4971951af)
| * | Merge commit 'origin/status-test' into status-testMartin Schwenke2009-11-247-251/+295
| |\ \ | | | | | | | | | | | | (This used to be ctdb commit 2e60749de3714239224cc04170a9aeeee158153f)
| | * | eventscript: check that ctdb forced script events correctRusty Russell2009-11-242-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: check that internal script events are being invoked correctlyRusty Russell2009-11-241-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: remove call name from state->optionsRusty Russell2009-11-241-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: put call type into state struct.Rusty Russell2009-11-241-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: introduce enum for different event script calls.Rusty Russell2009-11-247-23/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: put timeout inside ctdb_event_script_callback_vRusty Russell2009-11-245-23/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: typo cleanupsRusty Russell2009-11-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: fix bug in timeouts on forced eventscripts. Again.Rusty Russell2009-11-241-40/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | eventscript: clean up forked handler event codeRusty Russell2009-11-241-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
| | * | rework and simplify the eventscript handlingRonnie Sahlberg2009-11-242-153/+109
| | |/ | | | | | | | | | (This used to be ctdb commit c5f798116bf3b7954e23c7267b056ee1f5560f45)
| * / More eventscript cleanups. Initial smoke testing seems OK.Martin Schwenke2009-11-203-133/+63
| |/ | | | | | | | | | | | | | | | | | | 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)
| * Now vaguely tested initscript updates.Martin Schwenke2009-11-199-97/+91
| | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit f1e350f9edb74cc44b6c5be4c062fd93e98ba8c4)
| * More untested eventscript factorisation.Martin Schwenke2009-11-1916-232/+152
| | | | | | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit ac655b0a65b32d809d47fec9821f7f31bb2fe2a7)
| * Eventscripts: Untested factorisations and introduction of status event.Martin Schwenke2009-11-135-119/+229
| | | | | | | | | | | | | | | | | | | | | | | | | | 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)