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

28 Commits

Author SHA1 Message Date
Volker Lendecke
a11450d825 dbwrap: Convert dbwrap_delete to dbwrap_do_locked
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-08-16 00:27:10 +02:00
Volker Lendecke
5095733f92 dbwrap: Convert dbwrap_store to dbwrap_do_locked
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-08-16 00:27:10 +02:00
Volker Lendecke
cb2a28eb9a dbwrap: Add dbwrap_do_locked
With a proper implementation this enables modifications without
having to allocate a record. In really performance sensitive code
paths this matters.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:16 +02:00
Volker Lendecke
45f5a55ae6 dbwrap: Factor out the core dbwrap lock order logic
This will allow dbwrap_do_locked to check the order without talloc

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:16 +02:00
Volker Lendecke
10c59f5b20 dbwrap: Add dbwrap_record_storev
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:16 +02:00
Volker Lendecke
09915bf8e5 dbwrap: Convert backend store to storev
Convert all implementors of dbwrap_store to a storev-style call
by using the dbwrap_merge_dbufs call

For dbwrap_tdb, this matches tdb_storev.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:16 +02:00
Volker Lendecke
f0598e9853 dbwrap: Add dbwrap_merge_dbufs
Transitional code to implement dbwrap_record_storev

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-07-25 17:43:16 +02:00
Ralph Boehme
b3f8e9a62c dbwrap: add dbwrap_parse_record_send/recv
The req_state parameter tells the caller whether the async request is
blocked in a full send queue:

req_state >= DBWRAP_REQ_DISPATCHED := request is dispatched
req_state < DBWRAP_REQ_DISPATCHED := send queue is full

This is useful in a clustered Samba environment where the async dbwrap
request is sent over a socket to the local ctdbd.

If the send queue is full and the caller was issuing multiple async
dbwrap requests in a loop, the caller knows it's probably time to stop
sending requests for now and try again later.

This will be used in subsequent commits in
smbd_smb2_query_directory_send() when implementing async write time
updates. Directories may contain umpteen files so we send many requests
to ctdb without going through tevent and reading the responses which has
the potential to deadlock.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-04-18 22:54:16 +02:00
Volker Lendecke
fb71692128 dbwrap: Remove dbwrap_watchers.tdb based code
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2016-07-15 20:43:16 +02:00
Volker Lendecke
1a724a8f67 lib: Avoid "includes.h" in dbwrap.c
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2016-03-06 16:21:12 +01:00
Volker Lendecke
9964d60e3e dbwrap: Make dbwrap_db_id return size_t
This will make an on-stack db-id easier

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Volker Lendecke
225cba6e41 dbwrap: Remove unused dbwrap_hash_size()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2015-09-22 04:51:16 +02:00
Michael Adam
c7961ee495 dbwrap: completely check validity of lock order in dbwrap_check_lock_order()
This is currently not strictly necessay, because the
only caller catches the DBWRAP_LOCK_ORDER_NONE case,
and maximum is already checked,  but this seems too dangerous to me.

Use the new DBWRAP_LOCK_ORDER_VALID() macro.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:07 +01:00
Michael Adam
4eb57bd6e7 dbwrap: introduce DBWRAP_LOCK_ORDER_NONE for lock order "0".
Ther are still some databases which are opened (locally) with
lock oder 0, which means don't do lock oder checking,
thereby circumventing this deadlock-prevention mechanism.

Add a symbolic constant for this "0" to make this circumvention
more explicit.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-02-07 16:06:07 +01:00
Volker Lendecke
706c4deca1 dbwrap: No lock_order check if not required
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-12-14 10:10:41 +01:00
Volker Lendecke
fd94f82481 dbwrap: Avoid a stackframe in fetch_locked_internal
This shows in profiles. We call this so often that this is a pretty
hot code path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-12-14 10:08:07 +01:00
Volker Lendecke
56055f788c Revert "dbwrap: dbwrap_fetch_locked_timeout()."
This reverts commit f6eb187fda.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Rusty Russell <rusty@rustcorp.com.au>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Thu Jun  6 14:26:26 CEST 2013 on sn-devel-104
2013-06-06 14:26:26 +02:00
Volker Lendecke
e8657887a9 dbwrap: Add a comment explaining a restriction
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Mar 27 13:40:15 CET 2013 on sn-devel-104
2013-03-27 13:40:15 +01:00
Volker Lendecke
c03d5c5740 dbwrap: Prevent transactions on non-persistent dbs
dbwrap_ctdb does not allow this anyway. This patch will avoid suprises
when going non-clustered to clustered. Not everybody is developing
against a clustered environment :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-02-08 12:58:57 +01:00
Michael Adam
11850e4605 dbwrap: add dbwrap_is_persistent()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-01-15 14:49:20 +01:00
Gregor Beck
cff3ad4089 lib/dbwrap: rewrite lock order check to ease debugging
Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug  3 12:52:38 CEST 2012 on sn-devel-104
2012-08-03 12:52:38 +02:00
Rusty Russell
945473aac0 dbwrap: dbwrap_hash_size().
Implemented for ntdb and tdb; falls back to 0 for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
e92cb556fd dbwrap: dbwrap_name().
Useful for debug messages: particularly once we start switching between .tdb
and .ntdb files.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
41f799d877 dbwrap: dbwrap_transaction_start_nonblock().
Implemented for ntdb and tdb; falls back to the blocking variant
for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
f6eb187fda dbwrap: dbwrap_fetch_locked_timeout().
Implemented for ntdb and tdb; falls back to the non-timeout variant
for others.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
431667b47c dbwrap: add dbwrap_check() function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Rusty Russell
1acf548eb7 dbwrap: remove get_flags().
The flags returned were TDB-specific: this was only used for detecting
the endianness of obsolete databases (the conversion code was put in in
2003, with reference to Samba 2.3).

It's easier to remove it than to translate the NTDB flags to TDB flags,
and it's a really weird thing to ask for anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-22 07:35:17 +02:00
Michael Adam
e945511aae move the dbwrap library to the top level
Autobuild-User: Michael Adam <obnox@samba.org>
Autobuild-Date: Mon May 14 04:04:55 CEST 2012 on sn-devel-104
2012-05-14 04:04:55 +02:00