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

4942 Commits

Author SHA1 Message Date
Volker Lendecke
725b3654f8 s3: Avoid a thundering herd in g_lock_unlock
Only notify the first 5 pending lock waiters. This avoids a thundering herd
problem that is really nasty in a cluster. It also makes acquiring a lock a bit
more FIFO, lock waiters are added to the end of the array.
2010-02-16 13:21:10 +01:00
Volker Lendecke
07978bd175 s3: Optimize g_lock_lock for a heavily contended case
Only check the existence of the lock owner in g_lock_parse, check the rest of
the records only when we got the lock successfully. This reduces the load on
process_exists which can involve a network roundtrip in the clustered case.
2010-02-16 13:21:10 +01:00
Volker Lendecke
f3bdb163f4 s3: Fix handling of processes that died in g_lock
g_lock_parse might have thrown away entries from the locks array because the
processes were not around anymore. Don't store the orphaned entries.
2010-02-16 13:21:10 +01:00
Volker Lendecke
bac235dd30 s3: Fix a typo 2010-02-15 16:36:20 +01:00
Peter Watkins
d3a42946cc s3: Fix initgroups return check
A return code of 1 from initgroups() is OK since apparently it means
the gid has already been set. The man page doesn't mention this.
2010-02-14 12:45:04 +01:00
Andrew Tridgell
007f24f29d s3-lib: use TYPESAFE_QSORT() in s3 interfaces code 2010-02-14 18:44:20 +11:00
Volker Lendecke
613777e6dc s3: Remove unused comparison fn from "struct sorted_tree" 2010-02-13 13:26:11 +01:00
Volker Lendecke
3ab78e31f0 s3: Make adt_tree data definitions private to adt_tree.c 2010-02-13 13:26:11 +01:00
Volker Lendecke
2260732084 s3: SORTED_TREE -> struct sorted_tree 2010-02-13 13:26:11 +01:00
Volker Lendecke
ceebed6ce1 s3: TREE_NODE -> struct tree_node 2010-02-13 13:26:10 +01:00
Volker Lendecke
65b26ba985 s3: Fix some nonempty blank lines 2010-02-13 13:26:10 +01:00
Jeremy Allison
9252df53d9 Use sec_initial_uid() in the places where being root doesn't matter,
and 0 in the places where it does.

Jeremy
2010-02-12 23:18:53 -08:00
Jeremy Allison
10e54fb422 Fix warning messages on compile in g_lock.c Volker & Michael please check.
Jeremy.
2010-02-12 22:21:19 -08:00
Michael Adam
83fffbeb44 s3:g_lock: remove a nested event loop, replacing the inner loop by select
This made smbd crash in g_lock_lock() when trying to start a
transaction on a db with an already started transaction,
e.g. in a tcon_and_X where the share_info.tdb was not yet
initialized but share_info.tdb was already locked by another
process or writing acces to the winreg rpc pipe where the
registry tdb was already locked by another process.

What we really _want_ to do here by design is to react to
MSG_DBWRAP_G_LOCK_RETRY messages that are either sent
by a client doing g_lock_unlock or by ourselves when
we receive a CTDB_SRVID_SAMBA_NOTIFY or
CTDB_SRVID_RECONFIGURE message from ctdbd, i.e. when
either a client holding a lock or a complete node
has died.

Doing this properly involves calling tevent_loop_once(),
but doing this here with the main ctdbd messaging context
creates a nested event loop when g_lock_lock() is called
from the main event loop.

So as a quick fix, we act a little corasely here: we do
a select on the ctdb connection fd and when it is readable
or we get EINTR, then we retry without actually parsing
any ctdb packages or dispatching messages. This means that
we retry more often than necessary and intended by design,
but this does not harm and it is unobtrusive. When we have
finished, the main loop will pick up all the messages and
ctdb packets. The only extra twist is that we cannot use
timed events here but have to handcode a timeout for select.

Michael
2010-02-12 23:12:12 +01:00
Michael Adam
e4af0bc5af s3:ctdb_conn: add ctdbd_conn_get_fd() to get the fd out of the ctdb connection
Michael
2010-02-12 23:12:12 +01:00
Michael Adam
8e306b51b7 s3:g_lock: remove an unreached code path.
Michael
2010-02-12 23:12:12 +01:00
Michael Adam
1933214108 s3:dbwrap_ctdb: fix reading/storing of special key __db_sequence_number__
The key for reading and writing was inconsistent due to a
off by one data length.

Michael
2010-02-12 23:12:12 +01:00
Michael Adam
c311697ade s3:dbwrap_ctdb: exit early when nothing has been written in transaction_commit.
This skips update of the __db_sequence_number__ record when nothing else has
been written. There are transactions that are just openend and then nothing
is written until transaction_commit is called. This is for instance the case
with registry initialization routines: They start a transaction and only
write somthing when the registry has not been initialized yet.
So this change will skip many db_seqnum bumps and TRANS3_COMMIT roundtrips.

Michael
2010-02-12 23:12:12 +01:00
Michael Adam
1d594bd734 s3:dbwrap_ctdb: fix brown paperbag bug in ctdb_transaction_commit.
I carefully prepared the return value only to "return 0;" at the bottom. :-(
This may well have hit us for instance in the nested cancel case
and produced random errors.

Michael
2010-02-12 23:12:11 +01:00
Michael Adam
524072b56b s3:dbwrap_ctdb: fix logic error in pull_newest_from_marshall_buffer().
The logic bug was that if a record was found in the marshall buffer,
then always the ctdb header of tha last record in the marshall buffer
was returned, and not the ctdb header of the last occurrence of the
requested record.

This is fixed by introducing an additional temporary variable.

Michael
2010-02-12 23:12:11 +01:00
Michael Adam
1505b69dea s3:dbwrap_ctdb: fix an uninitialized variable.
Michael
2010-02-12 23:12:11 +01:00
Michael Adam
fb981cdb82 s3:dbwrap_ctdb: fix two "may be used uninitialized" warnings
Michael
2010-02-12 23:12:11 +01:00
Michael Adam
10a44ee693 s3:dbwrap_ctdb: fix db_ctdb_fetch_db_seqnum_from_db() when NT_STATUS_NOT_FOUND.
Don't treat this as an error but return seqnum 0 instead.

Michael
2010-02-12 23:12:11 +01:00
Michael Adam
3fe7ce141d s3:dbwrap_ctdb: maintain a database sequence number that bumps in transactions
For persistent databases, 64bit integer is kept in a special record
__db_sequence_number__. This record is incremented with each completed
transaction.

The retry mechanism for failing TRANS3_COMMIT controls inside the
db_ctdb_transaction_commit() function now relies one a modified
behaviour of ctdbd's treatment of persistent databases in recoveries.
Recently, a special treatment for persistent databases had been
introduced in ctdb (1.0.108) to work around the problems with the
orinal design of persistent transactions.
Now with the rewrite we need to revert to the old behaviour that
ctdb always takes the newest copies of all records.

This change also paves the way for a next step, which will make
recovery use the db seqnum to tell which node has the newest copy
of a persistent db and use that node's copy. This will greatly
reduce the amount of data transferred with each recovery.

Michael
2010-02-12 23:12:10 +01:00
Michael Adam
26225d3e79 s3:dbwrap_ctdb: change db_ctdb_transaction_store() to return NTSTATUS.
The return values calculated by the callers were wrong anyways since
the new marshalling code does not set the local tdbs tdb error code.

Michael
2010-02-12 23:12:10 +01:00
Michael Adam
5a0c42770b s3:dbwrap_ctdb: update (C)
Michael
2010-02-12 23:12:10 +01:00
Michael Adam
16bc6ba226 s3:dbwrap_ctdb: start rewrite of transactions using the global lock (g_lock)
This simplifies the transaction code a lot:

* transaction_start essentially consists of acquiring a global lock.

* No write operations at all are performed on the local database
  until the transaction is committed: Every store operation is just
  going into the marshall buffer.

* The commit operation calls a new simplified TRANS3_COMMIT control
  in ctdb which rolls out thae changes to all nodes including the
  node that is performing the transaction.

Michael
2010-02-12 23:12:09 +01:00
Volker Lendecke
12abab711b s3: Add ctdb_conn_msg_ctx() 2010-02-12 23:12:09 +01:00
Volker Lendecke
4c1c3f2549 s3: Implement global locks in a g_lock tdb
This is the basis to implement global locks in ctdb without depending on a
shared file system. The initial goal is to make ctdb persistent transactions
deterministic without too many timeouts.
2010-02-12 23:12:09 +01:00
Andrew Tridgell
32809bd8c1 util: rewrite dlinklist.h so that DLIST_ADD_END() is O(1)
This changes the meaning of the ->prev pointer in our doubly linked
lists to point at the end of the list from the front of the list. That
allows us to implement DLIST_ADD_END() and related functions in O(1)
time, which can be a huge saving in many places in Samba.

This also means that the 'type' argument to various DLIST_*() macros
is no longer needed, but I have left it in for now to keep the
patchset small, which will make it easier to revert if any problems
are found. In the future we should remove the 'type' arguments.

(jra. Move the one use of DLIST_TAIL over to the new macros).
2010-02-10 15:53:58 -08:00
Andrew Tridgell
7842b391b9 s3-memcache: update memcache to use new DLIST macros
we don't need a separate lru pointer any more
(cherry picked from commit 4ffd7aca3e38728077bd80c2a65c4efbcfd216fc)
2010-02-10 15:38:31 -08:00
Andrew Tridgell
54fc99e04b s3-ldb: update the old ldb in s3 to use new DLIST macros
(cherry picked from commit a7d8bfd373392eecf4fff33d39b85e1b55ad901d)
2010-02-10 15:38:16 -08:00
Jeremy Allison
32575ed70f Temporary changes to dlinklist to keep the implementation static whilst
uses of (list)->prev are moved over to DLIST_PREV. This will be replaced
when the final (new) version of the dlinklist.h header is added.

Jeremy.
2010-02-10 15:30:59 -08:00
Andrew Tridgell
5dbf175c75 s3-events: make the old timed events compatible with tevent
tevent ensures that a timed event is only called once. The old events
code relied on the called handler removing the event itself. If the
handler removed the event after calling a function which invoked the
event loop then the timed event could loop forever.

This change makes the two timed event systems more compatible, by
allowing the handler to free the te if it wants to, but ensuring it is
off the linked list of events before the handler is called, and
ensuring it is freed even if the handler doesn't free it.
2010-02-05 22:17:54 -08:00
Andrew Tridgell
74267d6524 s3-brlock: we don't need these MSG_SMB_UNLOCK calls now
These have been replaced with the min timeout in blocking.c
2010-02-05 22:17:26 -08:00
Jeremy Allison
899bd0005f Fix bug #7067 - Linux asynchronous IO (aio) can cause smbd to fail to respond to a read or write.
Only works on Linux kernels 2.6.26 and above. Grants CAP_KILL capability
to allow Linux threads under different euids to send signals to each other.

Jeremy.
2010-01-26 16:51:57 -08:00
Björn Jacke
55d448254a s3:netapi: remove unused variable 2010-01-26 00:19:09 +01:00
Volker Lendecke
2024d4fb27 Revert "s3: Make string_to_sid a wrapper around dom_sid_parse"
This reverts commit dff03b61fd.
2010-01-25 12:41:48 +01:00
Volker Lendecke
aa837d4aee s3: add libnetapi_set_use_ccache() 2010-01-24 20:32:17 +01:00
Volker Lendecke
21ec6a6cbd s3: Add -C (--use-ccache) to popt_common_credentials 2010-01-24 20:32:17 +01:00
Volker Lendecke
dff03b61fd s3: Make string_to_sid a wrapper around dom_sid_parse 2010-01-23 16:28:12 +01:00
Volker Lendecke
dbf9017a80 s3: Remove string_sid_talloc
All but one call were pointless, so I think this API should go
2010-01-23 14:35:37 +01:00
Volker Lendecke
9fcbe3a65c s3: Remove some pointless uses of string_sid_talloc 2010-01-23 14:35:37 +01:00
Volker Lendecke
8905b599b4 s3: Fix some nonempty blank lines 2010-01-23 14:35:37 +01:00
Volker Lendecke
24d4433bd7 s3: Move "yesno" to the only place where it is used: client.c 2010-01-21 12:58:11 +01:00
Volker Lendecke
f7adf534fd s3: For "smbcontrol <pid> pool-usage", print the first 50 bytes of a string 2010-01-17 15:04:25 +01:00
Volker Lendecke
a1015051c0 s3: Fix some nonempty blank lines 2010-01-17 15:03:15 +01:00
Stefan Metzmacher
915b7552b7 s3:smbldap: add smbldap_talloc_first_attribute()
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit c992127f8a)
2010-01-14 02:26:29 +01:00
Volker Lendecke
50b7a3233f s3: Remove unused samr_make_sam_obj_sd 2010-01-10 20:56:16 +01:00
Günther Deschner
1bc953088f s3-time: fix build warnings after we moved to shared time functions.
Bjoern, please check.

Guenther
2010-01-08 12:35:25 +01:00