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

558 Commits

Author SHA1 Message Date
Mathieu Parent
33b7470e82 Add kFreeBSD support
(This used to be ctdb commit c75e4ad9b566e47dec66d25988da4cee861c2357)
2012-01-31 14:14:21 +11:00
Ronnie Sahlberg
b5b4c1a2ea explain why we use FIONREAD
(This used to be ctdb commit d0f85478c37828eb8a24315d4326eb4eaedb9afc)
2012-01-04 21:41:12 +11:00
Michael Adam
3dab0c9b0b rb_tree: fix possible access-after-free-error in trbt_traversearray32_node
When the traverse callback frees the current node, the traverse of the
rbtree can fail (the next node->right fails since node is not there any more...).
This is fixed by introducing variables to store the right (and left)
pointers before the callback is called.

(This used to be ctdb commit 8b0caaeed154d26c67a73659d3bbbdd63b21be11)
2011-12-23 17:39:00 +01:00
Ronnie Sahlberg
c3ee62439f Return the peer_pid properly to the caller
(This used to be ctdb commit 0f15a2c65db8f8b4ac0d5ad2755b9aa3c2a8b279)
2011-12-06 13:16:15 +11:00
Mathieu Parent
1ed5288c38 GNU/Hurd support
CTDB has the following limitations on GNU Hurd:

- The pid of a peer is not get from the socket [1]. As a consequence, the peer
  process is not killed when releasing IP [2].

- Gratuitous arp are not yet supported [3]

- network interfaces are always considered present [4]

[1]: ctdb_get_peer_pid() in common/system_gnu.c
[2]: release_kill_clients() in server/ctdb_takeover.c
[3]: ctdb_sys_send_arp() in common/system_gnu.c
[4]: ctdb_sys_check_iface_exists() in common/system_gnu.c

(This used to be ctdb commit 00212e5c7dd229e7f8975a165d5ab8875d4917cc)
2011-12-06 11:58:14 +11:00
Mathieu Parent
bb3d6698e9 Move platform-specific code to common/system_*
This removes #ifdef AIX and ease the addition of new platforms.

(This used to be ctdb commit 2fd1067a075fe0e4b2a36d4ea18af139d03f17bf)
2011-12-06 11:57:11 +11:00
Michael Adam
5d94dff27e system_linux: correctly cast sockaddr_in6 to sockaddr for sendto() in ctdb_sys_send_tcp()
(This used to be ctdb commit 11bebd5367102fcd02b17c44ac87bf50d4c68785)
2011-11-26 00:34:54 +01:00
Michael Adam
d9516a8bf9 system_linux: correctly cast sockaddr_in to sockaddr in ctdb_sys_send_tcp()
(This used to be ctdb commit cc60df5a3edebfdf50fcd22ebfaad35736f90379)
2011-11-26 00:34:54 +01:00
Martin Schwenke
f186dd90b6 Move some common functions to common/ctdb_ltdb.c
Move identical copies of ctdb_null_func(), ctdb_fetch_func(),
ctdb_fetch_with_header_func() from ctdb_client.c and
ctdb_ltdb_server.c to somewhere common.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

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

(This used to be ctdb commit 126cb0d369b2b1aed63801dc4ba0554399e8b7e4)
2011-11-11 14:31:50 +11:00
Martin Schwenke
52ff485958 Added some #ifndefs to stop files being included multiple times.
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit fdca12c25e6fce6206135b994dedf44265e4eb09)
2011-11-11 14:31:50 +11:00
Martin Schwenke
c8286b8dc7 Clean up warnings: remove unused function dump_packet()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit c22e201be15e7d5b788c2f5f7916b553e0faaa2a)
2011-11-09 15:47:30 +11:00
Ronnie Sahlberg
0f92fa224c RB_TREE: Add mechanism to abort a traverse
This patch changes the callback signature for traversal
functions to allow a client to abort a traverse before it finishes.
Updates to all callers and examples as well as rb-test tool.

(This used to be ctdb commit 8ab0c63ad36cfbbb1e5fed46a1f4c47b1fdb581f)
2011-11-08 13:40:28 +11:00
Ronnie Sahlberg
8e4bfba75c ReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_header() since this is what it actually does.
(This used to be ctdb commit 94a5ce4e08e7891f07dbfe4c822ca4be5ab10965)
2011-09-13 18:38:20 +10:00
Ronnie Sahlberg
0dc5584101 Merge branch 'master-readonly-records' into foo
Conflicts:

	Makefile.in
	tools/ctdb.c

(This used to be ctdb commit 0fedef0ffba4178126eee9544c5e2db52f5db893)
2011-09-12 09:34:34 +10:00
Ronnie Sahlberg
1c05db2c9c Merge remote branch 'ddiss/master_pmda_and_client_timeouts'
(This used to be ctdb commit 7bebfc7bad8f36e54003b8e25372fdaf54836e21)
2011-09-08 11:22:53 +10:00
David Disseldorp
0628d1c0e6 client: add req timeout argument to ctdb_cmdline_client
Following connection to the local ctdbd, ctdb_cmdline_client() currently
issues a CTDB_CONTROL_GET_PNN request with a fixed 3 second timeout.

The ctdb cmd line client accepts a --timelimit argument for specifying
a per request timeout, pass this value through to ctdb_cmdline_client()
for use as a CTDB_CONTROL_GET_PNN request timeout.

(This used to be ctdb commit 0634d0305f42f17048b6830733767e8dc300e11c)
2011-09-06 13:56:54 +02:00
Ronnie Sahlberg
64378fea58 Check interfaces: when reading the public addresses file to create the vnn list
check that the actual interface exist, print error and fail startup if the interface does not exist.

(This used to be ctdb commit cd33bbe6454b7b0316bdfffbd06c67b29779e873)
2011-09-06 16:11:00 +10:00
Ronnie Sahlberg
1bbd4cbf35 ReadOnly: Add a ctdb_ltdb_fetch_readonly() helper function
(This used to be ctdb commit 8551420fb331dd2a897f4619278a981fcefb96e8)
2011-08-23 10:33:17 +10:00
Ronnie Sahlberg
f924b3f40e ReadOnly: Add helper functions to manipulate a TDB_DATA as a bitmap for nodes that we are tracking as having a readonly delegation
(This used to be ctdb commit d10084e62d37674bb8d9e31d457fd23e050545be)
2011-08-23 10:09:42 +10:00
Volker Lendecke
fff653d126 Remove an unused variable
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 04c3d9c7c9ffa8bb95b0bf1513fd79f6c1096a2f)
2011-08-22 17:11:07 +02:00
David Disseldorp
e097b7f8ff io: Make queue_io_read() safe for reentry
queue_io_read() may be reentered via the queue callback, recoverd is
particularly guilty of this.

queue_io_read() is not safe for reentry if more than one packet is
received and partial chunks follow - data read off the pipe on re-entry
is assumed to be the start-of-packet four byte length. This leads to a
wrongly aligned stream and the notorious "Invalid packet of length 0"
errors.

This change fixes queue_io_read() to be safe under reentry, only a
single packet is processed per call.

https://bugzilla.samba.org/show_bug.cgi?id=8319

(This used to be ctdb commit 9ea41d2fab612772f861270c8a59c01c43bd3a4c)
2011-08-05 14:27:18 +10:00
Michael Adam
9c91e16955 ltdb: add the CTDB_REC_FLAG_AUTOMATIC to the initial header in ctdb_ltdb_fetch()
Signals that this record was not created by a client level store.

(This used to be ctdb commit 69d34983a37b0324ff7610b8dfdcd8d13bf81c54)
2011-03-14 13:35:51 +01:00
Michael Adam
9e8d6b82b5 server: Use the ctdb_ltdb_store_server() in the ctdb daemon for non-persistent dbs
This is realized by adding a ctdb_ltdb_store_fn function pointer to the db
context and filling it in the attach procedure for non-persistent dbs.

(This used to be ctdb commit df49ec44de80affa5ccc637dec12a20a26e8706e)
2011-03-14 13:35:50 +01:00
Ronnie Sahlberg
b57bd0f896 Remove LACOUNT and LACCESSOR and migrate the records immediately.
This concept didnt work out and it is really just as expensive as a full migration
anyway, without the benefit of caching the data for subsequence accesses.

Now, migrate the records immediately on first access.
This will be combined with a "cheap vacuum-lite" for special empty records to
prevent growth of databases.

Later extensions to mimic read-only behaviour of records will include proper shared read-only locking of database records, making the laccessor/lacount read-only access to the data obsolete anyway.

By removing this special case and handling of lacount laccessor makes the codapath where shared read-only locking will be be implemented simpler, and frees up space in the ctdb_ltdb header for use by vacuuming flags as well as read-only locking flags.

(This used to be ctdb commit 155dd1f4885fe142c6f8bd09430f65daf8a17e51)
2011-02-18 10:08:32 +11:00
Ronnie Sahlberg
0aa2282c9c change the hash function to use the much better Jenkins hash
from the tdb library

cq S1020233

(This used to be ctdb commit b86feb6fe463dfdb67b2798491df18a4c434a430)
2011-02-18 10:05:09 +11:00
Ronnie Sahlberg
c4006ce844 Add ctdb_fork(0 which will fork a child process and drop the real-time
scheduler for the child.

Use ctdb_fork() from callers where we dont want the child to be running
at real-time privilege.

(This used to be ctdb commit 58795a4c9e0624e20fa3e0023b65127053edd103)
2011-01-11 07:40:41 +11:00
Ronnie Sahlberg
ea0df6d882 Revert scheduling back to use real-time processes
Revert this patch:
commit 482c302d46e2162d0cf552f8456bc49573ae729d

We may need to use real-time processes for the main daemon and the recovery daemon to handle the cases where systems come under very high loads.

(This used to be ctdb commit 08bef9dcab6e4da15fc783f8624e5ed09aa060b5)
2011-01-11 07:40:35 +11:00
Ronnie Sahlberg
c69ada0090 add a new ctdb_ltdb function to delete a record in a normal database
(This used to be ctdb commit fe9070ec9be69e6a6fcbf9899e7ced24541c9c3a)
2010-12-07 15:32:30 +11:00
Ronnie Sahlberg
1638a63dbe Drop the loglevel of the "reqid wrap" developer debug message to DEBUG
so that we dont spam the logs with this normal benign message.

(This used to be ctdb commit dc57df549854e329b453ef14cff5cd352632ef73)
2010-10-28 13:33:30 +11:00
Ronnie Sahlberg
90445abbab Revert "change the hash function to use the much better Jenkins hash"
This reverts commit f7e91ae905cd61249028e15f2cb509ea69f10b9e.

This may require a change to the ctdb protocol, or a mechanism
to negotiate/verify that we dont run with different hash fucntions
across the cluster.

Reverting the change until we decide how to solve this in the master
version.

(This used to be ctdb commit 2a2a7a201c90462295544ca23c8a3e215f140622)
2010-10-11 07:05:41 +11:00
Ronnie Sahlberg
6a7ecb7f42 change the hash function to use the much better Jenkins hash
from the tdb library

cq S1020233

(This used to be ctdb commit f7e91ae905cd61249028e15f2cb509ea69f10b9e)
2010-10-08 13:18:18 +11:00
Ronnie Sahlberg
39c367a68f Create macros to update the statistics counters and use these macros
everywhere instead of manipulating the coutenrs directly.

(This used to be ctdb commit 2e648df890e5713bc575965d87937827b068d0d7)
2010-09-29 12:14:24 +10:00
Harald Klatte
f3078b1c7f AIX bind wants the correct addrsize
(This used to be ctdb commit b5169e037fe113a5b62f510646b8fefc055c053b)
2010-09-03 11:49:19 +10:00
Ronnie Sahlberg
8d12313d6b ouch, the ordering of the constants and the strings must be kept in sync
manually   and ther eis no check for errors.     should fix this later

(This used to be ctdb commit e824af1a41f8ceec1edf6b3d1d6e1758fa00deb2)
2010-08-30 19:43:35 +10:00
Ronnie Sahlberg
c95f4258d8 Add a new event "ipreallocated"
This is called everytime a reallocation is performed.

    While STARTRECOVERY/RECOVERED events are only called when
    we do ipreallocation as part of a full database/cluster recovery,
    this new event can be used to trigger on when we just do a light
    failover due to a node becomming unhealthy.

    I.e. situations where we do a failover but we do not perform a full
    cluster recovery.

    Use this to trigger for natgw so we select a new natgw master node
    when failover happens and not just when cluster rebuilds happen.

(This used to be ctdb commit 7f4c591388adae20e98984001385cba26598ec67)
2010-08-30 18:09:30 +10:00
Ronnie Sahlberg
2e8aac6689 Merge commit 'rusty/ports-from-1.0.112' into foo
(This used to be ctdb commit 13e58d92f5f1723e850a82ae030d0ca57e89b1ee)
2010-08-19 13:17:56 +10:00
Rusty Russell
9fbb191b78 logging: give a unique logging name to each forked child.
This means we can distinguish which child is logging, esp. via syslog where we have no pid.

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

(This used to be ctdb commit 68b3761a0874429b90731741f0531f76dcfbb081)
2010-08-18 11:46:32 +09:30
Rusty Russell
f93440c4b7 event: Update events to latest Samba version 0.9.8
In Samba this is now called "tevent", and while we use the backwards
compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now
a separate tevent_fd_set_auto_close() function.

This is based on Samba version 7f29f817fa.

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


(This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
2010-08-18 09:16:31 +09:30
Rusty Russell
7061ceffd8 Report client for queue errors.
We've been seeing "Invalid packet of length 0" errors, but we don't know
what is sending them.  Add a name for each queue, and print nread.

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


(This used to be ctdb commit e6cf0e8f14f4263fbd8b995418909199924827e9)
2010-07-01 23:08:49 +10:00
Ronnie sahlberg
eee814ab47 Merge commit 'rusty/idtree'
(This used to be ctdb commit 069db55ea6fa6b8dd278b880c1a325e259f3e172)
2010-06-10 13:33:14 +10:00
Rusty Russell
5f9e4b60ae Delay reusing ids to make protocol more robust
Ronnie and I tracked down a bug which seems to be caused by a node
running so slowly that we timed out the request and reused the request
id before it responded.

The result was that we unlocked the wrong record, leading to the
following:

	ctdbd: tdb_unlock: count is 0
	ctdbd: tdb_chainunlock failed
	smbd[1630912]: [2010/06/08 15:32:28.251716,  0] lib/util_sock.c:1491(get_peer_addr_internal)
	ctdbd: Could not find idr:43
	ctdbd: server/ctdb_call.c:492 reqid 43 not found

This exact problem is now detected, but in general we want to delay
id reuse as long as possible to make our system more robust.

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


(This used to be ctdb commit 9eb9c53ef29f4871ae2fe62fc5cb6145fca89eed)
2010-06-10 08:58:55 +09:30
Ronnie Sahlberg
f6446adde3 print the db name qwhen a chainunlock fails too
(This used to be ctdb commit 7932156d7f25870e6937faca08bf75d3cdbad2e5)
2010-06-09 14:37:08 +10:00
Ronnie Sahlberg
64f2d69e4b when tdb_chainunlock() fails, print the tdb error that occured
(This used to be ctdb commit dcdd2010905b9007fbf7ab71f576cfbd48acce8a)
2010-06-09 14:36:59 +10:00
Ronnie Sahlberg
a4daf81a7c Additional log messages when tdb databases can no longer be chainlocked or chainunlocked
BZ64688

(This used to be ctdb commit b977901a49a9fed45cc8a2fe880eb749f58278f6)
2010-06-08 12:21:20 +10:00
Ronnie Sahlberg
f1b8bd94bb rename ctdb_message_fn_t to ctdb_msg_fn_t to avoid a conflict with the type of the same name used in libctdb
(This used to be ctdb commit 49e23f8329649e4d9eefab47c9b158fcc7210d07)
2010-06-02 10:00:58 +10:00
Ronnie Sahlberg
761a075de9 rename ctdb_send_message to ctdb_client_send_message to resolve colission with the function of the same name in libctdb
(This used to be ctdb commit ac3292c12832484a22715f1d46aa23f3b7c8a6f6)
2010-06-02 09:45:21 +10:00
Rusty Russell
d5f6026a22 libctdb: reorganize headers: remove ctdb.h, add ctdb_client.h and ctdb_protocol.h
ctdb_client.h is the existing internal client interface (which was mainly
in ctdb.h), and ctdb_protocol.h is the information needed for the wire
protocol only.

ctdb.h will be the new, shiny, libctdb API.

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

(This used to be ctdb commit 4bba6b8cd47b352f98d41f9f06258d5ac3c9adef)
2010-05-20 15:18:30 +09:30
Rusty Russell
72c275dd70 ctdb: use full range of IDR
This resolves a problem with huge numbers of requests which could overflow
16 bits.  Fortunately, the IDR should scale reasonably well, so we can simply
hold all the requests.

Although noone checks for failure, I added a constant for that.

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

(This used to be ctdb commit 72efc4122e37798227c3420a65ed1f706ca9ebe7)
2010-05-11 09:44:43 +10:00
Rusty Russell
e1b59b6a47 eventscript: don't do debugging system() from inside signal handler
In the case of a timeout, we dump a log of what's happening to a file
in /tmp.  We do it from the signal handler, which is an unreliable hack
(BZ58365).

Instead, create another (lower-priority) child to do the dump, then
kill the timedout script.

Note that this doesn't quite work as intended (the dump is often run
after the script has been killed), so the next patch resolves this.

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


(This used to be ctdb commit 7ee5ecc8d53e78e2dec21197b74a74cc4ae1834c)
2010-04-08 15:13:29 +09:30
Ronnie Sahlberg
06885ea9a7 In the recovery daemon, keep track of which node we have assigned public ip
addresses and verify that the remote nodes have/keep a consistent view of
assigned addresses.

If a remote node has an inconsistent view of addresses visavi the recovery
master this will trigger a full ip reallocation.

(This used to be ctdb commit f3bf2ab61f8dbbc806ec23a68a87aaedd458e712)
2010-04-08 14:25:26 +10:00