[SCM] Samba Shared Repository - branch master updated
Ralph Böhme
slow at samba.org
Tue Jul 25 19:36:02 UTC 2017
The branch, master has been updated
via e684658 messaging: Remove "struct messaging_backend"
via 7d24412 messaging: Remove messages_ctdbd.c
via af63c0b ctdb_conn: Use messaging_ctdb_connection
via d1add22 messaging: Use messaging_ctdb_ref()
via 67432fb messages_ctdb: Add messaging_ctdb_connection
via 0c70bcd smbpasswd: Initialize messaging for messaging_ctdb_conn
via 1cc970b dbwrap_ctdb: Use messaging_ctdbd_connection
via e26fa99 messaging: Add messages_ctdb_ref
via 5afdce0 messaging: Add messaging_ctdb_init/destroy
via 9cb1379 dbwrap: Avoid dbwrap_merge_dbufs in db_ctdb_storev
via fdad620 messages_ctdb: Handle async msgs for nested event contexts
via bd1e26f messaging: Add messaging_ctdbd_register_tevent_context
via dc390cf ctdbd_conn: Pass "ev" through ctdbd_socket_readable
via 3ee2e53 ctdbd_conn: Pass "ev" through ctdb_handle_message
via db84e7a ctdbd_conn: Pass "ev" through ctdbd_msg_call_back
via 2676455 ctdbd_conn: Pass "ev" through ctdb connection callbacks
via 35b4750 messaging: Broadcast messages to all event contexts
via 33df9c5 messaging: Keep an array of event contexts registered
via b561028 messaging: Add DLIST pointers to messaging_rec
via 17a472b messaging: Factor out messaging_dispatch_waiters
via 667307c g_lock: remove unused functions g_lock_get() and g_lock_get_talloc()
via 21df140 g_lock: Use parse_record in g_lock_dump
via 145b9cb g_lock: remove unused functions g_lock_put() and g_lock_record_store()
via 241f31d g_lock: Use dbwrap_do_locked in g_lock_write_data
via f540bba torture3: Add verification for g_lock_retry
via fc89187 g_lock: Use dbwrap_do_locked in g_lock_lock_retry
via 946e334 g_lock: Use dbwrap_do_locked for g_lock_lock
via 8d1e950 g_lock: Avoid talloc in g_lock_trylock
via a626f82 g_lock: Initialize variables
via e2aa568 g_lock: Implement g_lock_unlock without talloc
via 8f2a5f1 g_lock: add "struct g_lock" without talloc
via 2b6015f g_lock: simplify g_lock_trylock
via b03ca94 g_lock: Walk locks only once in g_lock_trylock
via ecb4283 dbwrap_watch: Implement do_locked
via faa5361 dbwrap_watch: Introduce dbwrap_watch_rec
via e3a0f0c dbwrap_tdb: Implement do_locked
via 86dbad3 torture3: Test dbwrap_do_locked
via cb2a28e dbwrap: Add dbwrap_do_locked
via 45f5a55 dbwrap: Factor out the core dbwrap lock order logic
via 10c59f5 dbwrap: Add dbwrap_record_storev
via 09915bf dbwrap: Convert backend store to storev
via f0598e9 dbwrap: Add dbwrap_merge_dbufs
via cfb6568 torture: Add local-g-lock-ping-pong
via bfa0732 s3: torture: Add a test for cli_setpathinfo_basic() to smbtorture3.
via b1e5b89 s3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().
via 2a15c70 s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
via 812006f s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change.
from ee9f437 auth/gensec: finally remove unused gensec_update_ev()
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e6846584d744974ca1256e52507ba09cc3ffa0ad
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 5 19:26:22 2017 +0200
messaging: Remove "struct messaging_backend"
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
Autobuild-User(master): Ralph Böhme <slow at samba.org>
Autobuild-Date(master): Tue Jul 25 21:35:49 CEST 2017 on sn-devel-144
commit 7d244129cc4db07d9a75ac76bb8572a881a642d2
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 5 19:24:32 2017 +0200
messaging: Remove messages_ctdbd.c
Replaced by messages_ctdb.[ch]
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit af63c0b32dbb726f03cb3b60be663257a6ad5031
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 16 13:00:59 2017 +0200
ctdb_conn: Use messaging_ctdb_connection
Replace messaging_ctdbd_connection
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit d1add225672dfc6b4970a07ca7b1068338f315bb
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 5 19:20:09 2017 +0200
messaging: Use messaging_ctdb_ref()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 67432fb9b9220e3826105b5b1b48391696e3ad99
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 5 19:13:23 2017 +0200
messages_ctdb: Add messaging_ctdb_connection
This will be the replacement for messaging_ctdbd_connection(). This does not
default to initializing messaging but panics. We just don't have correct
default arguments for messaging_init. Implicit multiple messaging and event
contexts is a bug also.
It *might* be that some tools fail due to this, but this needs fixing in
different ways. See the previous commit for smbpasswd.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 0c70bcdaf3f73c1f3014448d08f3ad092e2f14c2
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 16 15:20:39 2017 +0200
smbpasswd: Initialize messaging for messaging_ctdb_conn
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 1cc970be020567746d69c8f42ba551acc9ec8078
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 16 17:11:48 2017 +0200
dbwrap_ctdb: Use messaging_ctdbd_connection
With messages_ctdb, the global ctdb connection will change after fork.
Don't store the wrong parent connection across a fork. The alternative would
be to do a reinit on all dbwrap_ctdb databases, but that seems overkill
given that we only have one "standard" ctdb connection anyway.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e26fa9980ccb9d14e8920f0224473010da26a3b5
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jun 12 16:50:16 2017 +0200
messaging: Add messages_ctdb_ref
Modeled after messages_dgm_ref
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 5afdce0a6a388d7b5bb181ecca41024828025302
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jun 11 10:45:25 2017 +0200
messaging: Add messaging_ctdb_init/destroy
This models connecting to ctdb after the dgm code. The main point
is that we should never open more than more ctdb socket for messaging.
With more than one socket, we might end up with our pid registered with
ctdb on more than one socket. This could lead to memory overconsumption
in ctdb. ctdbd will eventually throw away messages, but they will take
up space unnecessarily.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 9cb137916c71e392e92b16c9f75141f92ae9a741
Author: Volker Lendecke <vl at samba.org>
Date: Tue Sep 13 14:22:05 2016 +0200
dbwrap: Avoid dbwrap_merge_dbufs in db_ctdb_storev
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit fdad620990aecb7d76e7360a7ce282c2686c0963
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 1 18:58:16 2017 +0200
messages_ctdb: Handle async msgs for nested event contexts
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit bd1e26f00e78b6bbafd71fd250953e936ec48e32
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 8 12:51:29 2017 +0200
messaging: Add messaging_ctdbd_register_tevent_context
We need to listen for the ctdb socket in nested event contexts
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit dc390cf989b3256d71f7ca8cffdc0b61a1c04ab8
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 1 18:00:45 2017 +0200
ctdbd_conn: Pass "ev" through ctdbd_socket_readable
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 3ee2e53b040dc0a3e8b03f01530b442090acc2da
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 1 17:55:06 2017 +0200
ctdbd_conn: Pass "ev" through ctdb_handle_message
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit db84e7a27790f688dbb9d325622761fbf25b0646
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 1 17:49:56 2017 +0200
ctdbd_conn: Pass "ev" through ctdbd_msg_call_back
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 267645545f3ef28cf6714126b4baf92a96fb8c6e
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 1 17:45:47 2017 +0200
ctdbd_conn: Pass "ev" through ctdb connection callbacks
This prepares the same logic we've implemented in messages_dgm for clustering
that is used in 6d3c064f1a5: We need to reply for messages from ctdb in nested
event contexts properly.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 35b4750ee335f01abd10fe2ac92b880c451456c8
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 22 08:54:56 2017 +0200
messaging: Broadcast messages to all event contexts
We must give all event contexts that might be interested the chance to pick up
the message. If we send a message to ourselves via messaging_send_iov_from,
nested event contexts need to get a chance to see the message. Before this
patch only the main event context in msg_ctx got it.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 33df9c538a18c515b696fa1e40d87ad9dbee8578
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jun 22 08:34:34 2017 +0200
messaging: Keep an array of event contexts registered
This is done with an explicit reference-counting and without talloc
destructors. The code is isolated enough for now that explicit refcount
management seems simpler. This might change in the future, but for
now keep it simple.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit b5610284533f8b434c7cee4b4ec5a5be3d394b83
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 17 08:48:35 2017 +0200
messaging: Add DLIST pointers to messaging_rec
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 17a472bc9918e469d3a33c21ed413735badd71da
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jun 17 15:43:14 2017 +0200
messaging: Factor out messaging_dispatch_waiters
No real code change: This makes dispatching to non-classic receives available
for other callers.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 667307cd781b754c3ca43f5948fae97785375e86
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 18 12:35:25 2017 +0200
g_lock: remove unused functions g_lock_get() and g_lock_get_talloc()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 21df1401abf39795b4e725cfdfe34e339c6c35d8
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 30 22:09:12 2017 +0200
g_lock: Use parse_record in g_lock_dump
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 145b9cbbf2a8df4f315928d34f40ec2ddfdd121c
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jul 18 12:34:11 2017 +0200
g_lock: remove unused functions g_lock_put() and g_lock_record_store()
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 241f31dbd4b990db7595a7816991796468f5706c
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 30 19:42:50 2017 +0200
g_lock: Use dbwrap_do_locked in g_lock_write_data
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f540bbaccd99906bc2e64f36c9ab5337298bd576
Author: Volker Lendecke <vl at samba.org>
Date: Mon Jul 3 08:09:18 2017 +0200
torture3: Add verification for g_lock_retry
During development I had a bug that would have been found early
by this
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit fc891872c275051e7de24c94284957c83755f3ba
Author: Volker Lendecke <vl at samba.org>
Date: Fri Jun 30 22:20:41 2017 +0200
g_lock: Use dbwrap_do_locked in g_lock_lock_retry
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 946e334b11150f91921254b78bce2d3e04ccd7ef
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 20:01:34 2017 +0200
g_lock: Use dbwrap_do_locked for g_lock_lock
Don't talloc the record
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 8d1e950cef3943ba311868af556c5dc289dc9386
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 19:39:33 2017 +0200
g_lock: Avoid talloc in g_lock_trylock
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit a626f822a2eb615c8c55071352156f646a093274
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jul 5 12:16:02 2017 +0200
g_lock: Initialize variables
gcc -O3 complains, but I think this is a false positive
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e2aa568bc8ff1bd42f16d45b4e4c84e2a4a11db5
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 15:39:49 2017 +0200
g_lock: Implement g_lock_unlock without talloc
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 8f2a5f141826f3f05a91fd2ab7c329521f02761e
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 13:36:53 2017 +0200
g_lock: add "struct g_lock" without talloc
Enable handing the g_lock.tdb content without having to talloc
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 2b6015f1e831c33810b52120bbdeae0075df5e68
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 19:12:36 2017 +0200
g_lock: simplify g_lock_trylock
The now mandatory talloc_realloc_array will go away soon
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit b03ca948d890440f3bfc5a6e66ff17e889511a29
Author: Volker Lendecke <vl at samba.org>
Date: Wed Jun 28 16:21:19 2017 +0200
g_lock: Walk locks only once in g_lock_trylock
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit ecb4283f3d3baa5619a55ceeef8acc8d487029f3
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jun 27 18:40:28 2017 +0200
dbwrap_watch: Implement do_locked
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit faa53616ea6e03c0676c72032d4720f12b4f9340
Author: Volker Lendecke <vl at samba.org>
Date: Sat Jul 1 18:13:44 2017 +0200
dbwrap_watch: Introduce dbwrap_watch_rec
The idea is to leave the "watchers" array unparsed until it's needed. This
avoids a few talloc calls and unnecessary parsing.
Also, it deletes quite a few lines of code and .text bytes.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit e3a0f0c1004770a8349c9089c3a19bcd7293ecb8
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jun 27 08:25:03 2017 +0200
dbwrap_tdb: Implement do_locked
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 86dbad3d68c74c0b84644b100252c6c4fb1c8c83
Author: Volker Lendecke <vl at samba.org>
Date: Tue Jun 27 08:25:36 2017 +0200
torture3: Test dbwrap_do_locked
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit cb2a28eb9a16a3bfe8d0373692acc4199f04baee
Author: Volker Lendecke <vl at samba.org>
Date: Wed Nov 9 08:45:59 2016 +0100
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 at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 45f5a55ae6bf2fdc09cbbc83c127628a1b55b6ef
Author: Volker Lendecke <vl at samba.org>
Date: Thu Jul 20 16:31:14 2017 +0200
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 at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 10c59f5b2052a5d3edf69444aaf46b05d2cd3a31
Author: Volker Lendecke <vl at samba.org>
Date: Tue Sep 13 12:25:14 2016 +0200
dbwrap: Add dbwrap_record_storev
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 09915bf8e5d59969cab7de0e75fd327046cffd8d
Author: Volker Lendecke <vl at samba.org>
Date: Mon Sep 12 17:30:55 2016 +0200
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 at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit f0598e985300afd287487cd4975a309cee6dfaa6
Author: Volker Lendecke <vl at samba.org>
Date: Mon Sep 12 17:11:09 2016 +0200
dbwrap: Add dbwrap_merge_dbufs
Transitional code to implement dbwrap_record_storev
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit cfb6568408269033316670fe9949d3622d5149f6
Author: Volker Lendecke <vl at samba.org>
Date: Mon May 22 21:55:11 2017 +0200
torture: Add local-g-lock-ping-pong
This is similar to the ctdb ping_pong test.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit bfa07323590357542eb06ad5faa2dc5a5736e3f1
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jul 21 15:11:08 2017 -0700
s3: torture: Add a test for cli_setpathinfo_basic() to smbtorture3.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit b1e5b894b089433e59c96915a27559d179bdb6c5
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jul 21 12:46:23 2017 -0700
s3: libsmb: Implement cli_smb2_setatr() by calling cli_smb2_setpathinfo().
This removes duplicate code paths and ensures we have only one
function calling the underlying smb2cli_set_info() for setting
info levels by path.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 2a15c70603bb23a68a2e3de0b00bfd98508f78e0
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jul 21 12:41:11 2017 -0700
s3: libsmb: Add cli_smb2_setpathinfo(), to be called by cli_setpathinfo_basic().
Fix to prevent libsmbclient from accidently making SMB1 calls inside an SMB2
connection.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
commit 812006fa8f26004609901b0ddef1c3ed05eff35e
Author: Jeremy Allison <jra at samba.org>
Date: Fri Jul 21 09:56:45 2017 -0700
s3: libsmbclient: Fix cli_setpathinfo_basic() to treat mode == -1 as no change.
This is only called from SMBC_setatr(), so bring it into line with
the specification for that function.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12913
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Ralph Boehme <slow at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/dbwrap/dbwrap.c | 198 +++++--
lib/dbwrap/dbwrap.h | 10 +
lib/dbwrap/dbwrap_private.h | 7 +-
lib/dbwrap/dbwrap_rbt.c | 25 +-
lib/dbwrap/dbwrap_tdb.c | 67 ++-
librpc/idl/messaging.idl | 2 +
source3/include/ctdbd_conn.h | 9 +-
source3/include/messages.h | 9 -
source3/lib/ctdb_dummy.c | 36 +-
source3/lib/ctdbd_conn.c | 27 +-
source3/lib/dbwrap/dbwrap_ctdb.c | 85 +--
source3/lib/dbwrap/dbwrap_ctdb.h | 1 -
source3/lib/dbwrap/dbwrap_open.c | 6 +-
source3/lib/dbwrap/dbwrap_watch.c | 480 +++++++++-------
source3/lib/g_lock.c | 632 +++++++++++----------
source3/lib/messages.c | 381 ++++++++++---
source3/lib/messages_ctdb.c | 268 +++++++++
.../lib/{messages_dgm_ref.h => messages_ctdb.h} | 28 +-
source3/lib/messages_ctdb_ref.c | 145 +++++
.../{messages_dgm_ref.h => messages_ctdb_ref.h} | 27 +-
source3/lib/messages_ctdbd.c | 290 ----------
source3/lib/messages_ctdbd.h | 38 --
source3/lib/serverid.c | 6 +-
source3/libsmb/cli_smb2_fnum.c | 73 ++-
source3/libsmb/cli_smb2_fnum.h | 5 +
source3/libsmb/clirap.c | 27 +-
source3/selftest/tests.py | 1 +
source3/smbd/notifyd/notifyd.c | 6 +-
source3/smbd/notifyd/notifydd.c | 4 +-
source3/smbd/process.c | 7 +-
source3/smbd/server.c | 7 +-
source3/torture/proto.h | 2 +
source3/torture/test_dbwrap_ctdb.c | 10 +-
source3/torture/test_dbwrap_do_locked.c | 154 +++++
source3/torture/test_g_lock.c | 152 ++++-
source3/torture/torture.c | 139 +++++
source3/utils/smbpasswd.c | 4 +
source3/wscript_build | 4 +-
38 files changed, 2242 insertions(+), 1130 deletions(-)
create mode 100644 source3/lib/messages_ctdb.c
copy source3/lib/{messages_dgm_ref.h => messages_ctdb.h} (59%)
create mode 100644 source3/lib/messages_ctdb_ref.c
copy source3/lib/{messages_dgm_ref.h => messages_ctdb_ref.h} (63%)
delete mode 100644 source3/lib/messages_ctdbd.c
delete mode 100644 source3/lib/messages_ctdbd.h
create mode 100644 source3/torture/test_dbwrap_do_locked.c
Changeset truncated at 500 lines:
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c
index 025d463..22437f6 100644
--- a/lib/dbwrap/dbwrap.c
+++ b/lib/dbwrap/dbwrap.c
@@ -82,17 +82,23 @@ TDB_DATA dbwrap_record_get_value(const struct db_record *rec)
return rec->value;
}
-NTSTATUS dbwrap_record_store(struct db_record *rec, TDB_DATA data, int flags)
+NTSTATUS dbwrap_record_storev(struct db_record *rec,
+ const TDB_DATA *dbufs, int num_dbufs, int flags)
{
NTSTATUS status;
- status = rec->store(rec, data, flags);
+ status = rec->storev(rec, dbufs, num_dbufs, flags);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
return NT_STATUS_OK;
}
+NTSTATUS dbwrap_record_store(struct db_record *rec, TDB_DATA data, int flags)
+{
+ return dbwrap_record_storev(rec, &data, 1, flags);
+}
+
NTSTATUS dbwrap_record_delete(struct db_record *rec)
{
NTSTATUS status;
@@ -104,11 +110,6 @@ NTSTATUS dbwrap_record_delete(struct db_record *rec)
return NT_STATUS_OK;
}
-struct dbwrap_lock_order_state {
- struct db_context **locked_dbs;
- struct db_context *db;
-};
-
static void debug_lock_order(int level, struct db_context *dbs[])
{
int i;
@@ -119,69 +120,86 @@ static void debug_lock_order(int level, struct db_context *dbs[])
DEBUGADD(level, ("\n"));
}
-static int dbwrap_lock_order_state_destructor(
- struct dbwrap_lock_order_state *s)
+static void dbwrap_lock_order_lock(struct db_context *db,
+ struct db_context ***lockptr)
{
- int idx = s->db->lock_order - 1;
+ static struct db_context *locked_dbs[DBWRAP_LOCK_ORDER_MAX];
+ int idx;
- DEBUG(5, ("release lock order %d for %s\n",
- (int)s->db->lock_order, s->db->name));
+ DBG_INFO("check lock order %d for %s\n", (int)db->lock_order,
+ db->name);
- if (s->locked_dbs[idx] != s->db) {
- DEBUG(0, ("locked db at lock order %d is %s, expected %s\n",
- idx + 1, s->locked_dbs[idx]->name, s->db->name));
- debug_lock_order(0, s->locked_dbs);
- smb_panic("inconsistent lock_order\n");
+ if (!DBWRAP_LOCK_ORDER_VALID(db->lock_order)) {
+ DBG_ERR("Invalid lock order %d of %s\n",
+ (int)db->lock_order, db->name);
+ smb_panic("lock order violation");
}
- s->locked_dbs[idx] = NULL;
+ for (idx=db->lock_order-1; idx<DBWRAP_LOCK_ORDER_MAX; idx++) {
+ if (locked_dbs[idx] != NULL) {
+ DBG_ERR("Lock order violation: Trying %s at %d while "
+ "%s at %d is locked\n",
+ db->name, (int)db->lock_order,
+ locked_dbs[idx]->name, idx + 1);
+ debug_lock_order(0, locked_dbs);
+ smb_panic("lock order violation");
+ }
+ }
- debug_lock_order(10, s->locked_dbs);
+ locked_dbs[db->lock_order-1] = db;
+ *lockptr = &locked_dbs[db->lock_order-1];
- return 0;
+ debug_lock_order(10, locked_dbs);
}
-
-static struct dbwrap_lock_order_state *dbwrap_check_lock_order(
- struct db_context *db, TALLOC_CTX *mem_ctx)
+static void dbwrap_lock_order_unlock(struct db_context *db,
+ struct db_context **lockptr)
{
- int idx;
- static struct db_context *locked_dbs[DBWRAP_LOCK_ORDER_MAX];
- struct dbwrap_lock_order_state *state = NULL;
+ DBG_INFO("release lock order %d for %s\n",
+ (int)db->lock_order, db->name);
- if (!DBWRAP_LOCK_ORDER_VALID(db->lock_order)) {
- DEBUG(0,("Invalid lock order %d of %s\n",
- (int)db->lock_order, db->name));
- smb_panic("invalid lock_order\n");
- return NULL;
+ if (*lockptr == NULL) {
+ DBG_ERR("db %s at order %d unlocked\n", db->name,
+ (int)db->lock_order);
+ smb_panic("lock order violation");
}
- DEBUG(5, ("check lock order %d for %s\n",
- (int)db->lock_order, db->name));
+ if (*lockptr != db) {
+ DBG_ERR("locked db at lock order %d is %s, expected %s\n",
+ (int)(*lockptr)->lock_order, (*lockptr)->name,
+ db->name);
+ smb_panic("lock order violation");
+ }
+ *lockptr = NULL;
+}
- for (idx=db->lock_order - 1; idx < DBWRAP_LOCK_ORDER_MAX; idx++) {
- if (locked_dbs[idx] != NULL) {
- DEBUG(0, ("Lock order violation: Trying %s at %d while %s at %d is locked\n",
- db->name, (int)db->lock_order, locked_dbs[idx]->name, idx + 1));
- debug_lock_order(0, locked_dbs);
- smb_panic("invalid lock_order");
- return NULL;
- }
- }
+struct dbwrap_lock_order_state {
+ struct db_context *db;
+ struct db_context **lockptr;
+};
+
+static int dbwrap_lock_order_state_destructor(
+ struct dbwrap_lock_order_state *s)
+{
+ dbwrap_lock_order_unlock(s->db, s->lockptr);
+ return 0;
+}
+
+static struct dbwrap_lock_order_state *dbwrap_check_lock_order(
+ struct db_context *db, TALLOC_CTX *mem_ctx)
+{
+ struct dbwrap_lock_order_state *state;
state = talloc(mem_ctx, struct dbwrap_lock_order_state);
if (state == NULL) {
- DEBUG(1, ("talloc failed\n"));
+ DBG_WARNING("talloc failed\n");
return NULL;
}
state->db = db;
- state->locked_dbs = locked_dbs;
- talloc_set_destructor(state, dbwrap_lock_order_state_destructor);
-
- locked_dbs[db->lock_order - 1] = db;
- debug_lock_order(10, locked_dbs);
+ dbwrap_lock_order_lock(db, &state->lockptr);
+ talloc_set_destructor(state, dbwrap_lock_order_state_destructor);
return state;
}
@@ -480,6 +498,42 @@ NTSTATUS dbwrap_parse_record_recv(struct tevent_req *req)
return tevent_req_simple_recv_ntstatus(req);
}
+NTSTATUS dbwrap_do_locked(struct db_context *db, TDB_DATA key,
+ void (*fn)(struct db_record *rec,
+ void *private_data),
+ void *private_data)
+{
+ struct db_record *rec;
+
+ if (db->do_locked != NULL) {
+ struct db_context **lockptr;
+ NTSTATUS status;
+
+ if (db->lock_order != DBWRAP_LOCK_ORDER_NONE) {
+ dbwrap_lock_order_lock(db, &lockptr);
+ }
+
+ status = db->do_locked(db, key, fn, private_data);
+
+ if (db->lock_order != DBWRAP_LOCK_ORDER_NONE) {
+ dbwrap_lock_order_unlock(db, lockptr);
+ }
+
+ return status;
+ }
+
+ rec = dbwrap_fetch_locked(db, db, key);
+ if (rec == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+
+ fn(rec, private_data);
+
+ TALLOC_FREE(rec);
+
+ return NT_STATUS_OK;
+}
+
int dbwrap_wipe(struct db_context *db)
{
if (db->wipe == NULL) {
@@ -556,3 +610,51 @@ const char *dbwrap_name(struct db_context *db)
{
return db->name;
}
+
+static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int num_dbufs,
+ uint8_t *buf, size_t buflen)
+{
+ size_t needed = 0;
+ uint8_t *p = buf;
+ int i;
+
+ for (i=0; i<num_dbufs; i++) {
+ size_t thislen = dbufs[i].dsize;
+ size_t tmp;
+
+ tmp = needed + thislen;
+ if (tmp < needed) {
+ /* wrap */
+ return -1;
+ }
+ needed = tmp;
+
+ if (needed <= buflen) {
+ memcpy(p, dbufs[i].dptr, thislen);
+ p += thislen;
+ }
+ }
+
+ return needed;
+}
+
+
+TDB_DATA dbwrap_merge_dbufs(TALLOC_CTX *mem_ctx,
+ const TDB_DATA *dbufs, int num_dbufs)
+{
+ ssize_t len = tdb_data_buf(dbufs, num_dbufs, NULL, 0);
+ uint8_t *buf;
+
+ if (len == -1) {
+ return (TDB_DATA) {0};
+ }
+
+ buf = talloc_array(mem_ctx, uint8_t, len);
+ if (buf == NULL) {
+ return (TDB_DATA) {0};
+ }
+
+ tdb_data_buf(dbufs, num_dbufs, buf, len);
+
+ return (TDB_DATA) { .dptr = buf, .dsize = len };
+}
diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h
index fac65ee..1161bf0 100644
--- a/lib/dbwrap/dbwrap.h
+++ b/lib/dbwrap/dbwrap.h
@@ -72,6 +72,8 @@ enum dbwrap_req_state {
TDB_DATA dbwrap_record_get_key(const struct db_record *rec);
TDB_DATA dbwrap_record_get_value(const struct db_record *rec);
NTSTATUS dbwrap_record_store(struct db_record *rec, TDB_DATA data, int flags);
+NTSTATUS dbwrap_record_storev(struct db_record *rec,
+ const TDB_DATA *dbufs, int num_dbufs, int flags);
NTSTATUS dbwrap_record_delete(struct db_record *rec);
struct db_record *dbwrap_fetch_locked(struct db_context *db,
TALLOC_CTX *mem_ctx,
@@ -81,6 +83,11 @@ struct db_record *dbwrap_try_fetch_locked(struct db_context *db,
TDB_DATA key);
struct db_context *dbwrap_record_get_db(struct db_record *rec);
+NTSTATUS dbwrap_do_locked(struct db_context *db, TDB_DATA key,
+ void (*fn)(struct db_record *rec,
+ void *private_data),
+ void *private_data);
+
NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key);
NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,
TDB_DATA data, int flags);
@@ -216,6 +223,9 @@ NTSTATUS dbwrap_parse_marshall_buf(const uint8_t *buf, size_t buflen,
NTSTATUS dbwrap_unmarshall(struct db_context *db, const uint8_t *buf,
size_t buflen);
+TDB_DATA dbwrap_merge_dbufs(TALLOC_CTX *mem_ctx,
+ const TDB_DATA *dbufs, int num_dbufs);
+
/**
* This opens a tdb file
diff --git a/lib/dbwrap/dbwrap_private.h b/lib/dbwrap/dbwrap_private.h
index 9b50ccc..e757215 100644
--- a/lib/dbwrap/dbwrap_private.h
+++ b/lib/dbwrap/dbwrap_private.h
@@ -29,7 +29,8 @@ struct tevent_req;
struct db_record {
struct db_context *db;
TDB_DATA key, value;
- NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag);
+ NTSTATUS (*storev)(struct db_record *rec, const TDB_DATA *dbufs,
+ int num_dbufs, int flag);
NTSTATUS (*delete_rec)(struct db_record *rec);
void *private_data;
};
@@ -67,6 +68,10 @@ struct db_context {
void *private_data,
enum dbwrap_req_state *req_state);
NTSTATUS (*parse_record_recv)(struct tevent_req *req);
+ NTSTATUS (*do_locked)(struct db_context *db, TDB_DATA key,
+ void (*fn)(struct db_record *rec,
+ void *private_data),
+ void *private_data);
int (*exists)(struct db_context *db,TDB_DATA key);
int (*wipe)(struct db_context *db);
int (*check)(struct db_context *db);
diff --git a/lib/dbwrap/dbwrap_rbt.c b/lib/dbwrap/dbwrap_rbt.c
index eb5ef10..d9c743b 100644
--- a/lib/dbwrap/dbwrap_rbt.c
+++ b/lib/dbwrap/dbwrap_rbt.c
@@ -118,7 +118,8 @@ overflow:
return -1;
}
-static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
+static NTSTATUS db_rbt_storev(struct db_record *rec,
+ const TDB_DATA *dbufs, int num_dbufs, int flag)
{
struct db_rbt_ctx *db_ctx = talloc_get_type_abort(
rec->db->private_data, struct db_rbt_ctx);
@@ -130,12 +131,23 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
struct db_rbt_node *parent_node = NULL;
ssize_t reclen;
- TDB_DATA this_key, this_val;
+ TDB_DATA data, this_key, this_val;
+ void *to_free = NULL;
if (db_ctx->traverse_read > 0) {
return NT_STATUS_MEDIA_WRITE_PROTECTED;
}
+ if (num_dbufs == 1) {
+ data = dbufs[0];
+ } else {
+ data = dbwrap_merge_dbufs(rec, dbufs, num_dbufs);
+ if (data.dptr == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ to_free = data.dptr;
+ }
+
if (rec_priv->node != NULL) {
/*
@@ -154,17 +166,20 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
*/
memcpy(this_val.dptr, data.dptr, data.dsize);
rec_priv->node->valuesize = data.dsize;
+ TALLOC_FREE(to_free);
return NT_STATUS_OK;
}
}
reclen = db_rbt_reclen(rec->key.dsize, data.dsize);
if (reclen == -1) {
+ TALLOC_FREE(to_free);
return NT_STATUS_INSUFFICIENT_RESOURCES;
}
node = talloc_zero_size(db_ctx, reclen);
if (node == NULL) {
+ TALLOC_FREE(to_free);
return NT_STATUS_NO_MEMORY;
}
@@ -232,6 +247,8 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
DLIST_ADD_AFTER(db_ctx->nodes, node, parent_node);
rb_insert_color(&node->rb_node, &db_ctx->tree);
+ TALLOC_FREE(to_free);
+
return NT_STATUS_OK;
}
@@ -350,7 +367,7 @@ static struct db_record *db_rbt_fetch_locked(struct db_context *db_ctx,
rec_priv = (struct db_rbt_rec *)
((char *)result + DBWRAP_RBT_ALIGN(sizeof(struct db_record)));
- result->store = db_rbt_store;
+ result->storev = db_rbt_storev;
result->delete_rec = db_rbt_delete;
result->private_data = rec_priv;
@@ -425,7 +442,7 @@ static int db_rbt_traverse_internal(struct db_context *db,
ZERO_STRUCT(rec);
rec.db = db;
rec.private_data = &rec_priv;
- rec.store = db_rbt_store;
+ rec.storev = db_rbt_storev;
rec.delete_rec = db_rbt_delete;
db_rbt_parse_node(rec_priv.node, &rec.key, &rec.value);
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c
index e12ec44..c30bede 100644
--- a/lib/dbwrap/dbwrap_tdb.c
+++ b/lib/dbwrap/dbwrap_tdb.c
@@ -25,6 +25,7 @@
#include "lib/util/util_tdb.h"
#include "system/filesys.h"
#include "lib/param/param.h"
+#include "libcli/util/error.h"
struct db_tdb_ctx {
struct tdb_wrap *wtdb;
@@ -35,7 +36,8 @@ struct db_tdb_ctx {
} id;
};
-static NTSTATUS db_tdb_store(struct db_record *rec, TDB_DATA data, int flag);
+static NTSTATUS db_tdb_storev(struct db_record *rec,
+ const TDB_DATA *dbufs, int num_dbufs, int flag);
static NTSTATUS db_tdb_delete(struct db_record *rec);
static void db_tdb_log_key(const char *prefix, TDB_DATA key)
@@ -137,7 +139,7 @@ static struct db_record *db_tdb_fetch_locked_internal(
talloc_set_destructor(state.result, db_tdb_record_destr);
state.result->private_data = ctx;
- state.result->store = db_tdb_store;
+ state.result->storev = db_tdb_storev;
state.result->delete_rec = db_tdb_delete;
DEBUG(10, ("Allocated locked data 0x%p\n", state.result));
@@ -173,6 +175,50 @@ static struct db_record *db_tdb_try_fetch_locked(
return db_tdb_fetch_locked_internal(db, mem_ctx, key);
}
+static NTSTATUS db_tdb_do_locked(struct db_context *db, TDB_DATA key,
+ void (*fn)(struct db_record *rec,
+ void *private_data),
+ void *private_data)
+{
+ struct db_tdb_ctx *ctx = talloc_get_type_abort(
+ db->private_data, struct db_tdb_ctx);
+ uint8_t *buf = NULL;
+ struct db_record rec;
+ int ret;
+
+ ret = tdb_chainlock(ctx->wtdb->tdb, key);
+ if (ret == -1) {
+ enum TDB_ERROR err = tdb_error(ctx->wtdb->tdb);
+ DBG_DEBUG("tdb_chainlock failed: %s\n",
+ tdb_errorstr(ctx->wtdb->tdb));
+ return map_nt_error_from_tdb(err);
+ }
+
+ ret = tdb_fetch_talloc(ctx->wtdb->tdb, key, ctx, &buf);
+
+ if ((ret != 0) && (ret != ENOENT)) {
+ DBG_DEBUG("tdb_fetch_talloc failed: %s\n",
+ strerror(errno));
+ tdb_chainunlock(ctx->wtdb->tdb, key);
+ return map_nt_error_from_unix_common(ret);
+ }
+
+ rec = (struct db_record) {
+ .db = db, .key = key,
+ .value = (struct TDB_DATA) { .dptr = buf,
+ .dsize = talloc_get_size(buf) },
+ .storev = db_tdb_storev, .delete_rec = db_tdb_delete,
+ .private_data = ctx
+ };
+
+ fn(&rec, private_data);
+
+ talloc_free(buf);
+
+ tdb_chainunlock(ctx->wtdb->tdb, key);
+
+ return NT_STATUS_OK;
+}
static int db_tdb_exists(struct db_context *db, TDB_DATA key)
{
@@ -236,10 +282,12 @@ static NTSTATUS db_tdb_parse(struct db_context *db, TDB_DATA key,
return NT_STATUS_OK;
}
-static NTSTATUS db_tdb_store(struct db_record *rec, TDB_DATA data, int flag)
+static NTSTATUS db_tdb_storev(struct db_record *rec,
--
Samba Shared Repository
More information about the samba-cvs
mailing list