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

138 Commits

Author SHA1 Message Date
Andreas Schneider
2b890679a6 messages: Use uint8_t type.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:12 +01:00
Stefan Metzmacher
935a40f4f2 s3:lib: s/struct event_context/struct tevent_context
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-02-19 23:47:54 +01:00
Stefan Metzmacher
ced27e1c5d s3:lib: make sure we don't try to send messages to server_id's marked as disconnected
metze

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug 24 15:54:48 CEST 2012 on sn-devel-104
2012-08-24 15:54:48 +02:00
Volker Lendecke
ed43a5a94f s3: Fix a valgrind error
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Thu Mar 29 15:50:13 CEST 2012 on sn-devel-104
2012-03-29 15:50:13 +02:00
Volker Lendecke
c19753bb1f s3: Add debug when a message is registered
We've always had the corresponding deregister message

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Jan 24 15:27:51 CET 2012 on sn-devel-104
2012-01-24 15:27:51 +01:00
Stefan Metzmacher
7d83d379ad s3:lib/messages: remove unused messaging_event_context()
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Jan 17 09:45:30 CET 2012 on sn-devel-104
2012-01-17 09:45:29 +01:00
Volker Lendecke
0f9d14820e s3: Remove a bunch of calls to procid_self()
All callers to messaging_[re]init only used procid_self()
2011-12-12 21:50:25 +01:00
Volker Lendecke
d5fe21c003 s3: Fix some nonempty blank lines
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Oct 31 14:25:14 CET 2011 on sn-devel-104
2011-10-31 14:25:14 +01:00
Volker Lendecke
625ad07f4f s3: Fix a comment 2011-10-31 12:48:06 +01:00
Michael Adam
e2328ac33c s3:messages: convert to use only dbwrap wrapper functions
Avoid direct use of the db_record and db_context structs.
2011-10-11 14:17:57 +02:00
Simo Sorce
b706fd37f6 s3-messaging: Fix messaging classes.
This has been broken since ff0ac5b0 (May 2007).
Basically all messages were belonging to the General class except for CTDB
messages.
This fixed the message_send_all() function to correctly compute the class, and
fixes registrations to include all they need to cope with the fact not all
messages are of calss general (registrations rotted a bit because as long as
FLAG_MSG_GENERAL was defined the process woould receive all messages).

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:58:01 +02:00
Simo Sorce
cb1af61cb1 s3-messaging: Remove obsolete class.
The FLAG_MSG_PRINT_NOTIFY class is actually obsolete and never used, as the
only message belonging to it is not used either.

Signed-off-by: Andreas Schneider <asn@samba.org>
2011-08-11 14:57:55 +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
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Volker Lendecke
411c52aba3 s3: Fix two debug messages
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Mon Jun  6 14:11:06 CEST 2011 on sn-devel-104
2011-06-06 14:11:06 +02:00
Jeremy Allison
e131c94ac1 More const fixes for compiler warnings from the waf build. 2011-05-05 23:56:07 +02:00
Günther Deschner
ab36d597e7 s3-messages: make ndr_messaging.h part of messages.h.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
b2af281e50 s3-messages: only include messages.h where needed.
Guenther
2011-03-30 01:13:09 +02:00
Günther Deschner
8643683dd8 s3-server_id: only include server_id where needed.
Guenther
2011-03-02 12:12:31 +01:00
Jeremy Allison
781c4aabb8 Move error reporting of messaging context creation fail into
the daemons themselves. Allows client utilities to silently
fail to create a messaging context due to access denied on the
messaging tdb (which I need for the following patch).

Jeremy.
2010-11-14 04:39:05 +00:00
Volker Lendecke
808ceac9f5 s3: messaging_ctdbd_init potentially modifies my_vnn
If we call messaging_ctdbd_connection() we end up with the wrong vnn in our
messaging context.

This is a bit of a hack, get_my_vnn() needs to go eventually along with
procid_self()
2010-08-31 17:07:41 +02:00
Volker Lendecke
5e58156654 s3: Fix a typo 2010-08-28 13:10:58 +02:00
Günther Deschner
7a05ca2c9c s3-build: use dbwrap.h only where needed.
Guenther
2010-08-26 00:25:55 +02:00
Volker Lendecke
0220246c26 s3: Add messaging_server_id 2010-07-05 11:06:24 +02:00
Volker Lendecke
5a3c64668a s3: Re-initialize the server_id in messaging_reinit 2010-07-04 17:29:23 +02:00
Volker Lendecke
89c785c47a s3: Fix a long-standing problem with recycled PIDs
When a samba server process dies hard, it has no chance to clean up its entries
in locking.tdb, brlock.tdb, connections.tdb and sessionid.tdb.

For locking.tdb and brlock.tdb Samba is robust by checking every time we read
an entry from the database if the corresponding process still exists. If it
does not exist anymore, the entry is deleted. This is not 100% failsafe though:
On systems with a limited PID space there is a non-zero chance that between the
smbd's death and the fresh access, the PID is recycled by another long-running
process. This renders all files that had been locked by the killed smbd
potentially unusable until the new process also dies.

This patch is supposed to fix the problem the following way: Every process ID
in every database is augmented by a random 64-bit number that is stored in a
serverid.tdb. Whenever we need to check if a process still exists we know its
PID and the 64-bit number. We look up the PID in serverid.tdb and compare the
64-bit number. If it's the same, the process still is a valid smbd holding the
lock. If it is different, a new smbd has taken over.

I believe this is safe against an smbd that has died hard and the PID has been
taken over by a non-samba process. This process would not have registered
itself with a fresh 64-bit number in serverid.tdb, so the old one still exists
in serverid.tdb. We protect against this case by the parent smbd taking care of
deregistering PIDs from serverid.tdb and the fact that serverid.tdb is
CLEAR_IF_FIRST.

CLEAR_IF_FIRST does not work in a cluster, so the automatic cleanup does not
work when all smbds are restarted. For this, "net serverid wipe" has to be run
before smbd starts up. As a convenience, "net serverid wipedbs" also cleans up
sessionid.tdb and connections.tdb.

While there, this also cleans up overloading connections.tdb with all the
process entries just for messaging_send_all().

Volker
2010-03-10 16:07:10 +01:00
Andrew Tridgell
6f1f9f6d8d fixed a bug in message handling for code the change notify code
The change notify code registered a separate message handler for each
tree connect. This registration uses the global messaging context.

The messaging code would consider a 2nd registration for the same
messaging type as being an 'update' of the handler, rather than a new
handler. It also would only call the first handler in the linked list
for a given message type when dispatching messages.

This patch changes the messaging code to allow for multiple
registrations of the same message type, and allow for multiple calls
to different messaging handler for one incoming message.

This fixes the problem with the test_notify_tcon() test that I
recently committed to the S4 smbtorture
2009-03-10 16:45:45 +11:00
Stefan Metzmacher
930b3c15da s3:messaging: also recreate the local messaging backend in messaging_reinit()
This prepares the change to use signal events in the tdb backend.

metze
2009-01-20 00:41:45 +01:00
Michael Adam
0412c20386 messages: bump debug level to 1 for "messaging_ctdb_init failed".
Leave level 0 messages to higher level callers.

Michael
(This used to be commit 7bbf29137b)
2008-06-26 12:31:11 +02:00
Stefan Metzmacher
c316c7ab73 messaging: add FLAG_MSG_DBWRAP message class flag
metze
(This used to be commit ee6325495f)
2008-04-12 09:14:08 +02:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Volker Lendecke
33c57437a4 r24032: It helps testing tremendously if the cluster messaging actually sends
and receives messages to other nodes... :-)
(This used to be commit 3e9e9a3f28)
2007-10-10 12:28:58 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Volker Lendecke
de565785f5 r23410: Merge the core of the cluster code.
I'm 100% certain I've forgotten to merge something, but the main code
should be in. It's mainly in dbwrap_ctdb.c, ctdbd_conn.c and
messages_ctdbd.c.

There should be no changes to the non-cluster case, it does survive make
test on my laptop.

It survives some very basic tests with ctdbd enables, I did not do the
full test suite for clusters yet.

Phew...

Volker
(This used to be commit 15553d6327)
2007-10-10 12:23:14 -05:00
Volker Lendecke
f96193a2cb r23343: Fix error return
(This used to be commit 0014ee44b8)
2007-10-10 12:23:07 -05:00
Volker Lendecke
3f5742e20b r23204: Add MSG_SMB_BRL_VALIDATE. Tridge, this is a bit different from your bzr
branch, please check if it fulfils your needs.

Two changes: The validation is not done inside the brlock.c traverse_fn,
it's done as a separate routine.

Secondly, this patch does not call the checker routines in smbcontrol
directly but depends on a running smbd.
(This used to be commit 7e39d77c1f)
2007-10-10 12:22:53 -05:00
Volker Lendecke
054bf2fc8b r23171: Convert connections.tdb to dbwrap
(This used to be commit 80a1f43825)
2007-10-10 12:22:52 -05:00
Volker Lendecke
f260b45d64 r23117: Factor out local messaging.
This removes message_block / message_unblock. I've talked to Jeremy and
Günther, giving them my reasons why I believe they have no effect.
Neither could come up with a counter-argument, so they go :-)
(This used to be commit a925e0991f)
2007-10-10 12:22:47 -05:00
Volker Lendecke
ff0ac5b0e7 r23112: Trim down the message.c API slightly: The messages_pending_for_pid is now
replaced by MSG_FLAG_LOWPRIORITY or'ed into the msg_type. To enable this,
changed the msg_type definitions to hexadecimal.

This way we could theoretically add the MSG_FLAG_NODUPLICATES again, but I
would rather not do this, because that one is racy and can't be guaranteed at
all.
(This used to be commit 3f5eb8a960)
2007-10-10 12:22:47 -05:00
Volker Lendecke
2991d3416b r23077: Minor cleanup
(This used to be commit 72ed838825)
2007-10-10 12:22:43 -05:00
Volker Lendecke
ac3f08ddbe r23055: Rewrite messages.c to use auto-generated marshalling in the tdb. I'm
doing this because for the clustering the marshalling is needed in more
than one place, so I wanted a decent routine to marshall a message_rec
struct which was not there before.

Tridge, this seems about the same speed as it used to be before, the
librpc/ndr overhead in my tests was under the noise.

Volker
(This used to be commit eaefd00563)
2007-10-10 12:22:17 -05:00
Volker Lendecke
772d8b0cd3 r23025: Some logic simplifications
(This used to be commit d3f16722b2)
2007-10-10 12:22:16 -05:00
Volker Lendecke
9e5dbf3fd1 r23024: Ok, neither the duplicates_allowed nor the timeout argument to
message_send_pid is used anymore. Two users of duplicates_allowed: winbind and
the printer notify system.

I don't thing this really changes semantics: duplicates_allowed is hell racy
anyway, we can't guarantee that we don't send the same message in sequence
twice, and I think the only thing we can harm with the print notify is
performance.

For winbind I talked to Günther, and he did not seem too worried.

Volker
(This used to be commit 75b3ae6a76)
2007-10-10 12:22:16 -05:00
Volker Lendecke
e0ebb46cff r23023: Get rid of the only caller of message_send_pid_with_timeout(). This replaces
the timeouts on the individual message send calls with an overall timeout on
all the calls.

The timeout in message_send_pid_with_timeout() did not make much sense IMO
anyway, because the tdb_fetch() for the messages_pending_for_pid was blocking
in a readlock anyway, we "just" did the timeout for the write lock.

This new code goes through the full wait for the write lock once and then
breaks out of sending the notifies instead of running into the timeout per
target.

Jerry, please check this!

Thanks,

Volker
(This used to be commit 697099f06e)
2007-10-10 12:22:16 -05:00
Volker Lendecke
23c0e27b6c r23022: Reformatting
(This used to be commit 782ee72916)
2007-10-10 12:22:15 -05:00
Volker Lendecke
4d5f58c2b9 r23015: Make message_(de)register static to messages.c
(This used to be commit a8082a3c7c)
2007-10-10 12:22:15 -05:00
Volker Lendecke
56e6e5b8ca r22934: Change smbcontrol to use messaging_register instead of message_register
(This used to be commit e3d985c581)
2007-10-10 12:22:10 -05:00
Volker Lendecke
8c3f8e5697 r22911: Pass a messaging_context to message_send_all
(This used to be commit cc92ce665d)
2007-10-10 12:22:07 -05:00
Volker Lendecke
6669aa051e r22910: Make message_send_pid static to messages.c
(This used to be commit 27224922cf)
2007-10-10 12:22:07 -05:00