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

131 Commits

Author SHA1 Message Date
Amitay Isaacs
79992dbb73 ctdb-common: Use sin6_len only if the structure supports it
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13493

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2018-07-02 08:51:20 +02:00
Martin Schwenke
ca315203be ctdb-common: Drop debugging variable CTDB_EXTERNAL_TRACE
This was an attempt to debug an unexpected situation.  It never
triggered, so delete it and all supporting code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2018-03-01 19:39:15 +01:00
Martin Schwenke
28d6356a65 ctdb-common: Ensure unused bytes in union are initialised
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-11-07 03:53:27 +01:00
Martin Schwenke
c98691c340 ctdb-common: Replace parse_ip() -> ctdb_sock_addr_from_string()
... and ctdb_sock_addr_set_port().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2017-10-05 05:19:21 +02:00
Amitay Isaacs
682676a89f ctdb-common: Use correct db_id size in marshalling record buffer
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-09-14 08:39:28 +02:00
Volker Lendecke
2600f823de ctdb: Improve debug in case of set_runstate failure
If this fails, we want to know which states it wanted to move to. Don't do the
return before the debug.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-05-16 19:52:21 +02:00
Amitay Isaacs
3f314154fe ctdb-common: Replace ctdb_logging.h with common/logging.h
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-16 00:46:15 +01:00
Amitay Isaacs
b99436e425 ctdb-daemon: Rename struct ctdb_rec_data to ctdb_rec_data_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
afc5d8a442 ctdb-daemon: Rename struct ctdb_node_map to ctdb_node_map_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
4647787773 ctdb-daemon: Separate prototypes for common client/server functions
This groups function prototypes for common client/server functions in
common/common.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
01c6c90e98 ctdb-daemon: Remove dependency on includes.h
Instead of includes.h, include the required header files explicitly.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
b900adc55c ctdb-daemon: Separate prototypes for system specific functions
This groups function prototypes for system specific functions in
common/system.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
b25c1135a7 ctdb-daemon: Use reqid abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Michael Adam
15ac12af9c ctdb: strip trailing spaces from nodes file.
Signed-off-by: Michael Adam <obnox at samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Sat Jun 27 13:20:18 CEST 2015 on sn-devel-104
2015-06-27 13:20:18 +02:00
Martin Schwenke
a2c64a4810 ctdb-common: Reimplement external tracing using ctdb_set_helper()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-05-10 03:22:13 +02:00
Martin Schwenke
1ef1cfdc4d ctdb-common: Move ctdb_node_list_to_map() to utilities
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-04-07 07:43:13 +02:00
Martin Schwenke
5148228f41 ctdb-daemon: Move ctdb_read_nodes_file() to utilities
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
a5be2c245d ctdb-daemon: Store node addresses as ctdb_sock_addr rather than strings
Every time a nodemap is contructed the node IP addresses all need to
be parsed.  This isn't very productive use of CPU.

Instead, parse each string once when the nodes file is loaded.  This
results in much simpler code.

This code also removes the use of ctdb_address.  Duplicating the port
is pointless without an abstraction layer around ctdb_address.  If
CTDB gets an incompatible transport in the future then add an
abstraction layer.

Note that the infiniband code is not updated.  Compilation of the
infiniband code is already broken.  Fixing it will be a separate,
properly tested effort.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
3cbeb17d0f ctdb-common: Drop ctdb context from ctdb_parse_address()
Having it require a CTDB context stops ctdb_parse_address() from being
used in more generic code.  Just use the existing talloc context for
memory allocations.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
89b08c0f0b ctdb-common: New function ctdb_set_helper()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-03-10 15:29:06 +01:00
Amitay Isaacs
e3c59d83d0 ctdb-daemon: Fix IP address comparisons for IPv6 addresses
Before storing node IP address, convert into the correct abbreviated
string form for IPv6 addresses.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-12-05 21:02:40 +01:00
Amitay Isaacs
bd13389467 ctdb-common: Refactor code to convert TDB_DATA key to aligned uint32 array
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-09-05 07:05:10 +02:00
Martin Schwenke
6fd3ce5391 ctdb-daemon: Fix some strict-aliasing warnings
Seeing these with -Wall:

  ../server/ctdb_call.c:1117:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     record_flags = *(uint32_t *)&c->data[c->keylen + c->datalen];
     ^

memcpy() seems to be the easiest way to get fix these.  The
alternative would be to use unmarshalling functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-08-21 04:46:13 +02:00
Martin Schwenke
2807b185f4 ctdb-util: Fix warning about ignored result from system()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-08-21 04:46:13 +02:00
Amitay Isaacs
42ba7a0a40 ctdb-util: Refactor record marshalling routines to avoid extra talloc
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
64ea6e30ef ctdb-util: Refactor ctdb_marshall_record
Create new routines ctdb_marshall_record_size and ctdb_marshall_record_copy

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
5eac230281 ctdb-util: Fix nonempty line endings
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
49e34651a9 ctdb-common: Move mkdir_p_or_die to system utilities
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
4736486188 ctdb-daemon: Rename ctdb_mkdir_p_or_die to mkdir_p_or_die
This function does not require ctdb context.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
507207e40b ctdb-common: Move lockdown_memory to system utilities
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
8c8ef5640e ctdb-daemon: Rename ctdb_lockdown_memory to lockdown_memory
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
22f71579a4 ctdb-daemon: Instead of passing ctdb context, pass valgrinding boolean
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
e114830124 ctdb-common: Keep debug level related functions with logging code
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
da1a6a3d31 ctdb-common: Remove unused functions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
7226618717 ctdb-common: Separate more system utilities that are independent of ctdb
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Martin Schwenke
8fa8b3b397 ctdb-common: Do not dynamically allocate memory when not necessary
Copy these values onto the stack instead.  INET6_ADDRSTRLEN is 46, so
64 is plenty for an IP address and a port number.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
3a9d375328 ctdb-common: Drop ctdb prefix from utility functions independent of ctdb
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
5b580e5d65 ctdb-common: Changing scheduler policy does not require ctdb context
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
fb0b389dc1 ctdb-common: Do not abort if restoring scheduling policy fails
This code is only executed in child processes, so aborting does not
really achieve much.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
19fcf6ff52 ctdb-common: No need to save previous scheduler priority
When calling sched_setscheduler() with SCHED_OTHER, the only valid
priority is 0.  Nice value is "restored" anyway.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-12 05:40:10 +02:00
Amitay Isaacs
af3a168ed3 ctdb-util: Do not use mlockall() on AIX
Memory lockdown causes recovery daemon to crash on AIX.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-04 01:02:11 +01:00
Amitay Isaacs
7562701153 ctdb-common: Coverity fixes
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-19 17:13:05 +01:00
Martin Schwenke
bd73e017b0 common: New function ctdb_mkdir_p_or_die()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 7b971df79b0b63f83555205eacf48d49ca3a273a)
2013-10-25 12:06:06 +11:00
Amitay Isaacs
a42b6e1cad common/util: Use AIX specific code for setting high priority for CTDB daemon
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7764cf67a61bbf1caad5aa8e2d75a262b9da654c)
2013-10-22 14:33:56 +11:00
Martin Schwenke
066b671de0 utils: Make debug level strings case-insensitive
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c700dd0c7b6b43b61b3e231643b5d7cbe2f9592a)
2013-09-25 14:35:31 +10:00
Martin Schwenke
d30e269ecc common: Make parse_ip() valgrind-clean
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c0bb147ca09e82019b05ec22995623cffc3184e2)
2013-09-11 15:35:38 +10:00
Michael Adam
aa1360aeb2 util: In passing the code, fix a space vs. tab in set_close_on_exec().
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit f9556a6f1fe0046308c8b363e6dcaf3f7ce6f2b7)
2013-08-19 17:12:33 +02:00
Martin Schwenke
dbd1759eae util: New function ctdb_die()
This is like ctdb_fatal() but exits cleanly without dumping core or
generating a backtrace.

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

(This used to be ctdb commit c0a9456692c88a7a5542cd893d8f326524d3f94e)
2013-07-05 15:52:33 +10:00
Mathieu Parent
d82b9ae410 build: Fix tdb.h path to enable building with system TDB library
(This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
2013-06-14 16:45:27 +10:00
Martin Schwenke
6d9667f01c ctdbd: Add new runstate CTDB_RUNSTATE_FIRST_RECOVERY
This adds more serialisation to the startup, ensuring that the
"startup" event runs after everything to do with the first recovery
(including the "recovered" event).

Given that it now takes longer to get to the "startup" state, the
initscript needs to wait until ctdbd gets to "first_recovery".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ed6814ff0a59ddbb1c1b3128b505380f60d7aeb7)
2013-05-24 14:08:07 +10:00