summaryrefslogtreecommitdiffstats
path: root/source3/lib/g_lock.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/util: Remove sys_poll as it is no longer neededAndrew Bartlett2012-02-161-6/+6
| | | | | | | | | | | sys_poll() is only needed if the signal pipe is set up and used, but as no signal handler ever writes to the pipe, this can all be removed. signal based events are now handled via tevent. Andrew Bartlett Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Add a "lock_order" argument to db_openVolker Lendecke2012-01-181-1/+2
| | | | | | | 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.
* s3: Remove a bunch of calls to procid_self()Volker Lendecke2011-12-121-4/+3
| | | | All callers to messaging_[re]init only used procid_self()
* s3:g_lock: convert to use only dbwrap wrapper functions.Michael Adam2011-10-111-15/+30
| | | | Avoid direct use of the db_record and db_context structs.
* s3:g_lock: add a missing \n to a debug message in g_lock_initMichael Adam2011-09-201-1/+1
|
* s3: let g_lock_unlock() return more specific status codes on failureGregor Beck2011-09-071-2/+2
| | | | Signed-off-by: Michael Adam <obnox@samba.org>
* s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/Michael Adam2011-07-291-1/+1
| | | | | Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
* s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.Michael Adam2011-07-291-0/+1
| | | | | | 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.
* s3:g_lock: explicitly include dbwrap.hMichael Adam2011-07-291-0/+1
|
* s3:g_lock: g_lock.tdb should not be executableChristian Ambach2011-06-271-1/+2
| | | | | | | | TDBs are not executable, so do not create the file with the execution bit set Autobuild-User: Christian Ambach <ambi@samba.org> Autobuild-Date: Mon Jun 27 17:09:12 CEST 2011 on sn-devel-104
* lib/util Bring procid_str() into lib/util as server_id_string()Andrew Bartlett2011-06-091-5/+5
| | | | | | | This is needed for OpenChange, which prints Samba struct server_id values in debug messages. Andrew Bartlett
* s3-talloc Change TALLOC_ARRAY() to talloc_array()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_ARRAY isn't standard talloc.
* s3: only include tdb headers where needed.Günther Deschner2011-05-061-0/+1
| | | | Guenther
* s3: Fix g_lock_lock after the select/poll conversionVolker Lendecke2011-03-301-1/+1
| | | | | | | | Without clustering we don't have an fd to listen on, and sys_poll needs one element of space Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Mar 30 18:36:50 CEST 2011 on sn-devel-104
* s3-messages: make ndr_messaging.h part of messages.h.Günther Deschner2011-03-301-1/+0
| | | | Guenther
* s3-messages: only include messages.h where needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* s3-includes: only include system/filesys.h when needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* s3: Eliminate sys_select from g_lock_lockVolker Lendecke2011-02-281-11/+31
|
* samba: share select wrappers.Günther Deschner2010-10-011-0/+1
| | | | Guenther
* Change to using TDB_INCOMPATIBLE_HASH (the jenkins hash) on allJeremy Allison2010-09-271-1/+1
| | | | | | | | | | TDB_CLEAR_IF_FIRST tdb's. For tdb's like gencache where we open without CLEAR_IF_FIRST and then with CLEAR_IF_FIRST if corrupt this is still safe to use as if opening an existing tdb the new hash will be ignored - it's only used on creating a new tdb not opening an old one. Jeremy.
* s3-build: only include ctdbd_conn.h where needed.Günther Deschner2010-09-201-0/+1
| | | | Guenther
* s3: messaging_ctdbd_connection() was only called with procid_self()Volker Lendecke2010-08-311-8/+3
| | | | Eventually we'll get this right...
* s3: Remove the dependency of g_lock on procid_selfVolker Lendecke2010-08-281-9/+13
| | | | procid_self() references global vars, don't depend on them unnecessarily
* s3: Pass procid_self() explicitly to messaging_ctdbd_connection()Volker Lendecke2010-07-051-3/+6
|
* s3: only include gen_ndr headers where needed.Günther Deschner2010-05-061-0/+1
| | | | | | | | | | | | | | | | | This shrinks include/includes.h.gch by the size of 7 MB and reduces build time as follows: ccache build w/o patch real 4m21.529s ccache build with patch real 3m6.402s pch build w/o patch real 4m26.318s pch build with patch real 3m6.932s Guenther
* s3: Add "g_lock_do" as a convenience wrapper functionVolker Lendecke2010-03-121-0/+64
|
* s3: Fix timeout calculation if g_lock_lock is given a timeout < 60sVolker Lendecke2010-02-161-1/+6
| | | | Detected while showing this code to obnox :-)
* s3: Slightly increase parallelism in g_lockVolker Lendecke2010-02-161-1/+7
| | | | | There's no need to still hold the g_lock tdb-level lock while telling the waiters to retry
* s3: Avoid starving locks when many processes die at the same timeVolker Lendecke2010-02-161-6/+4
| | | | | | | In g_lock_unlock we have a little race between the process_exists and messaging_send call: We only send to 5 waiters now, they all might have died between us checking their existence and sending the message. This change makes g_lock_lock retry at least once every minute.
* s3: Avoid a thundering herd in g_lock_unlockVolker Lendecke2010-02-161-1/+16
| | | | | | 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.
* s3: Optimize g_lock_lock for a heavily contended caseVolker Lendecke2010-02-161-3/+36
| | | | | | 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.
* s3: Fix handling of processes that died in g_lockVolker Lendecke2010-02-161-3/+5
| | | | | 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.
* s3: Fix a typoVolker Lendecke2010-02-151-1/+1
|
* Fix warning messages on compile in g_lock.c Volker & Michael please check.Jeremy Allison2010-02-121-14/+4
| | | | Jeremy.
* s3:g_lock: remove a nested event loop, replacing the inner loop by selectMichael Adam2010-02-121-38/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* s3:g_lock: remove an unreached code path.Michael Adam2010-02-121-4/+0
| | | | Michael
* s3: Implement global locks in a g_lock tdbVolker Lendecke2010-02-121-0/+594
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.