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

66 Commits

Author SHA1 Message Date
Volker Lendecke
af63c0b32d ctdb_conn: Use messaging_ctdb_connection
Replace messaging_ctdbd_connection

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:18 +02:00
Volker Lendecke
ce9e92c114 lib: Give messages_ctdbd.c its own header
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-06-21 03:15:07 +02:00
Volker Lendecke
9af73f62ce lib: Add lib/util/server_id.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-01-22 18:30:11 +01:00
Volker Lendecke
f396449e7a lib: Move "message_send_all" to serverid.c
Trying to trim down messages.c a bit: Sending to all processes that are
registered in serverid.tdb and filtering to me is not really logic of general
messaging but more of the serverid code.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2016-07-28 05:00:19 +02:00
Volker Lendecke
3194a4d342 lib: Remove unused serverid_get_random_unique_id
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Oct 19 15:12:22 CEST 2015 on sn-devel-104
2015-10-19 15:12:22 +02:00
Volker Lendecke
620b7467ad lib: Remove ctdb_serverids_exist
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Volker Lendecke
103658ddd0 lib: Remove serverids_exist
The only reason for this complex monster was an overload of ctdbd.
When opening files, we unconditionally checked all share modes for
validity. This meant thousands of serverid_exists calls per second
for popular directories. This has long gone, now we only check for
validity if a conflict happens.

The only remaining caller is net serverid wipedbs, an administrative
command. If that loads ctdbd, so be it.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Volker Lendecke
b542ce7db3 lib: Use messaging_dgm_get_unique in serverid_exists
This is a relevant change: I was experimenting with
server_id_db_set_exclusive() in "net" and got failures all over the
place. The main reason was that "net" by default does not do a
serverid_register. With messaging_dgm we have the process' unique
id available via the lockfile contents. Using open/read/close is a
bit slower than local tdb access, but this version is safe for all
processes which have done messaging_init()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-09-30 23:51:13 +02:00
Volker Lendecke
467fee4d5a ctdbd_conn: Add callback args to register_with_ctdbd
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-05-28 11:13:09 +02:00
David Disseldorp
d6792eca3c serverid: don't leak lock_path onto talloc tos
Also check for allocation failures.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-03 23:46:05 +01:00
Volker Lendecke
d997d93af1 lib: Remove unused serverid_register_msg_flags()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-07-31 18:49:46 +02:00
Volker Lendecke
d108dad61e serverid: Fix an incompatible pointer assignment
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-05-27 02:15:10 +02:00
Stefan Metzmacher
74e2d6e786 s3:lib: always use db_open(serverid.tdb)
We should not create an empty local serverid.tdb in a cluster setup...

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-05-12 18:43:07 +02:00
Volker Lendecke
d6db35d7a5 tdb_wrap: Remove tdb_wrap_open_ again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:14 +02:00
Volker Lendecke
604b970d67 serverid: Avoid passing lp_ctx to tdb_wrap_open in serverid_parent_init
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-03-31 22:52:13 +02:00
Stefan Metzmacher
74b359c616 s3:build: remove global CLUSTER_SUPPORT define
All ctdb specific code is isolated in samba-cluster-support.so now.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Mar 24 19:08:44 CET 2014 on sn-devel-104
2014-03-24 19:08:44 +01:00
Stefan Metzmacher
1c96c068ad s3:serverid: use ctdb_serverids_exist_supported() runtime check
This is better than a compile time check for
HAVE_CTDB_CONTROL_CHECK_SRVIDS_DECL.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-03-24 17:09:10 +01:00
Michael Adam
cf0cb0add9 dbwrap: add a dbwrap_flags argument to db_open()
This is in preparation to support handing flags to backends,
in particular activating read only record support for ctdb
databases. For a start, this does nothing but adding the
parameter, and all databases use DBWRAP_FLAG_NONE.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:06 +01:00
Stefan Metzmacher
9529301503 s3:lib: readd the CTDB_CONTROL_CHECK_SRVIDS optimization to serverids_exist()
metze
2012-08-24 13:43:33 +02:00
Stefan Metzmacher
18c6757dbb s3:lib: only loop over the server_ids we need to verify in serverids_exist()
metze
2012-08-24 13:43:33 +02:00
Stefan Metzmacher
6c3c25b5c1 s3:lib: use server_id_is_disconnected() in serverids_exist()
metze
2012-08-24 13:43:33 +02:00
Stefan Metzmacher
dc7d0f6883 s3:lib: inline processes_exist() into serverids_exist()
metze
2012-08-24 13:43:32 +02:00
Stefan Metzmacher
84b5a5cbcd s3:lib: SERVERID_UNIQUE_ID_NOT_TO_VERIFY only means not to verify the 'unique_id' part
It doesn't mean the the server_id is always valid.

metze
2012-08-24 13:43:32 +02:00
Stefan Metzmacher
99b134adbe s3:lib: implement serverid_exists() as wrapper of serverids_exist()
metze
2012-08-24 13:43:31 +02:00
Stefan Metzmacher
6145329fcd s3:lib: remove CTDB_CONTROL_CHECK_SRVIDS optimization in serverids_exist() for now
This will be readded...

metze
2012-08-24 13:43:30 +02:00
Stefan Metzmacher
6a58c5fc64 s3:lib: implement serverid_equal() as macro of server_id_equal()
metze
2012-08-17 20:07:07 +02:00
Andrew Bartlett
666dba3353 s3-param: Rename loadparm_s3_context -> loadparm_s3_helpers
This helps clarify the role of this structure and wrapper function.

The purpose here is to provide helper functions to the lib/param
loadparm_context that point back at the s3 lp_ functions.  This allows
a struct loadparm_context to be passed to any point in the code, and
always refer to the correct loadparm system.  If this has not been
set, the variables loaded in the lib/param code will be returned.

As requested by Michael Adam.

Andrew Bartlett

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 27 17:11:16 CEST 2012 on sn-devel-104
2012-06-27 17:11:16 +02:00
Stefan Metzmacher
ad82c52db0 s3:serverid: don't ignore the result of dbwrap_parse_record()
metze
2012-06-22 12:56:45 +02:00
Michael Adam
b240406651 s3:move serverid_equal() to serverid.c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-21 08:27:32 +02:00
Jelmer Vernooij
ce4531ee31 tdb_wrap: Move to specific directory.
It's a bit confusing to mix low-level and high-level libraries.  We had
multiple libraries in one directory, and there were have circular
dependencies with other libraries outside that directory (in this case,
samba-hostconfig).

Autobuild-User: Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date: Sat Mar 10 23:13:01 CET 2012 on sn-devel-104
2012-03-10 23:13:01 +01:00
Volker Lendecke
dd5868d41e s3: Add SERVERID_UNIQUE_ID_NOT_TO_VERIFY, bug 8760
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Feb 15 21:10:22 CET 2012 on sn-devel-104
2012-02-15 21:10:22 +01:00
Volker Lendecke
45e61fcf61 s3: Add a "lock_order" argument to db_open
This will be used to enforce a lock hierarchy between the databases. We have
seen deadlocks between locking.tdb, brlock.tdb, serverid.tdb and notify*.tdb.
These should be fixed by refusing a dbwrap_fetch_locked that does not follow a
defined lock hierarchy.
2012-01-18 14:48:04 +01:00
Volker Lendecke
26fc72921f s3-dbwrap: Make dbwrap_parse_record return NTSTATUS
Also, the parser now returns void. The parser is called if and only if
dbwrap_parse_record returns NT_STATUS_OK.

Signed-off-by: Michael Adam <obnox@samba.org>
2011-12-15 16:00:45 +01:00
Volker Lendecke
99f2177e8f s3-ctdb: Make use of CTDB_CONTROL_CHECK_SRVIDS
This should be a lot quicker than PROCESS_EXISTS followed by looking at
serverid.tdb

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Wed Nov 30 12:47:27 CET 2011 on sn-devel-104
2011-11-30 12:47:27 +01:00
Volker Lendecke
37d7d52358 s3: Add serverids_exist 2011-10-27 20:28:31 +02:00
Andrew Bartlett
01c934c81e lib/util: Add back control of mmap and hash size in tdb for top level build
This passes down a struct loadparm_context to allow these
parameters to be checked.  This may be s3 or s4 context, allowing the
#if _SAMBA_BUILD_ macro to go away safely.

Andrew Bartlett
2011-10-13 14:06:07 +02:00
Michael Adam
85ae3c3fd4 s3:serverid: convert to using dbwrap wrapper functions only
Avoid direct use of the db_record and db_context structs.
2011-10-11 14:17:56 +02:00
Michael Adam
91e77f3640 s3:serverid: use dbwrap_traverse_read() in serverid_traverse_read()
This also fixes the return value: originally the int return value
of traverse_read which is a count of the records traversed or negative
upon failure, was simply casted into a bool return value.
2011-10-11 14:17:56 +02:00
Michael Adam
81258c01b8 s3:serverid: use dbwrap_traverse() in serverid_traverse()
This also fixes the return value: Originally, the int returned
by the traverse method, which is the count of the traverse was
casted into a bool return value.
2011-10-11 14:17:56 +02:00
Volker Lendecke
5007ad3026 s3: Slightly simplify serverid_exists
procid_is_me() works fine in the clustering case as well

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Mon Aug 22 21:28:13 CEST 2011 on sn-devel-104
2011-08-22 21:28:13 +02:00
Ira Cooper
f6e3484ba6 Re-arrange the optimization to reduce tdb fcntl calls if smbd is not
clustered. procid_is_me() is much cheaper to test and can optimize
up to 50% of the calls to serverid_exists(). Volker please check.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Sat Aug 20 01:15:07 CEST 2011 on sn-devel-104
2011-08-20 01:15:07 +02:00
Michael Adam
0b5c4a601a s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29 13:34:22 +02:00
Michael Adam
1abdd9b2bb s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.
Also start new folder lib/dbwrap/ where dbwrap_open.c is stored and
make the fallbacke implementation functoins non-static and create a
dbwrap_private.h header file that contains their prototypes.
2011-07-29 12:23:13 +02:00
Rusty Russell
d925b327f4 tdb_compat: Higher level API fixes.
My previous patches fixed up all direct TDB callers, but there are a
few utility functions and the db_context functions which are still
using the old -1 / 0 return codes.

It's clearer to fix up all the callers of these too, so everywhere is
consistent: non-zero means an error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-20 11:18:35 +02:00
Andrew Bartlett
cc3b75b807 s3-server_id Add task_id to server_id to match Samba4
This will allow this structure to be shared, and allow us to create a
common messaging system between all Samba processes.  Samba4 uses the
task_id to indicate the different tasks within a single unix process.

Andrew Bartlett

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-06-09 12:40:08 +02:00
Günther Deschner
d8cfca3a9b s3: only include tdb headers where needed.
Guenther
2011-05-06 10:48:10 +02:00
Andrew Bartlett
1475013963 lib/util Move source3 tdb_wrap_open() into the common code.
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in
the top level build, these options are not available for these
databases.  However, having two different tdb_wrap lists is a worse
fate, so this will do for now.

Andrew Bartlett
2011-05-06 07:51:24 +02:00
Günther Deschner
0e771263ee s3-includes: only include system/filesys.h when needed.
Guenther
2011-03-30 01:13:07 +02:00
Andrew Bartlett
09c4a5cd9b s3-cluster Always fill in the clustering vnn element
This avoids this structure being partially uninitialised.

Adnrew Bartlett
2011-02-17 16:02:19 +01:00
Volker Lendecke
d60d49efb0 s3: Fix serverid_exists
In the cluster case it can happen that a node just died and we did not yet have
the time to clean up serverid.tdb. If the corresponding serverid.tdb record
that represented a process was migrated away from the dead record, it
represents existence of a process where it is already dead.
2010-12-19 23:25:06 +01:00