summaryrefslogtreecommitdiff
path: root/source3/lib/g_lock.c
Commit message (Collapse)AuthorAgeFilesLines
* tevent: Fix callers of tevent_req_set_endtimeVolker Lendecke2018-04-241-2/+0
| | | | | | | | tevent_req_set_endtime internally already calls tevent_req_nomem and thus sets the error status correctly. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Make g_lock_locks use TDB_DATAVolker Lendecke2018-02-081-7/+3
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Thu Feb 8 14:50:49 CET 2018 on sn-devel-144
* lib: Make g_lock_dump use TDB_DATAVolker Lendecke2018-02-081-6/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_do use TDB_DATAVolker Lendecke2018-02-081-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_write_data use TDB_DATAVolker Lendecke2018-02-081-5/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_unlock use TDB_DATAVolker Lendecke2018-02-081-7/+9
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_lock use TDB_DATAVolker Lendecke2018-02-081-4/+4
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Make g_lock_lock_send use TDB_DATAVolker Lendecke2018-02-081-8/+7
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:g_lock: keep old mylock on error and don't store new mylock on errorStefan Metzmacher2018-01-101-2/+17
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* g_lock: fix cleanup of stale entries in g_lock_trylock()Stefan Metzmacher2017-12-201-1/+5
| | | | | | | | | | | | | | | | | | g_lock_trylock() always incremented the counter 'i', even after cleaning a stale entry at position 'i', which means it skipped checking for a conflict against the new entry at position 'i'. As result a process could get a write lock, while there're still some read lock holders. Once we get into that problem, also more than one write lock are possible. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13195 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Dec 20 20:31:48 CET 2017 on sn-devel-144
* s3:glock: Move sanity check in g_lock_parse()Andreas Schneider2017-12-101-2/+2
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sun Dec 10 00:46:26 CET 2017 on sn-devel-144
* dbwrap_watch: Remove the "prec" parameter from watch_recvVolker Lendecke2017-11-291-1/+1
| | | | | | | | | | | The initial idea was to have some "atomicity" in this API. Every caller interested in a record would have to do something with it once it changes. However, only one caller really used this feature, and that is easily changed to not use it. So remove the complexity. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: remove unused functions g_lock_get() and g_lock_get_talloc()Volker Lendecke2017-07-251-76/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use parse_record in g_lock_dumpVolker Lendecke2017-07-251-24/+64
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: remove unused functions g_lock_put() and g_lock_record_store()Volker Lendecke2017-07-251-80/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked in g_lock_write_dataVolker Lendecke2017-07-251-34/+62
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked in g_lock_lock_retryVolker Lendecke2017-07-251-28/+25
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Use dbwrap_do_locked for g_lock_lockVolker Lendecke2017-07-251-21/+43
| | | | | | | Don't talloc the record Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Avoid talloc in g_lock_trylockVolker Lendecke2017-07-251-39/+28
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Initialize variablesVolker Lendecke2017-07-251-2/+2
| | | | | | | gcc -O3 complains, but I think this is a false positive Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Implement g_lock_unlock without tallocVolker Lendecke2017-07-251-45/+50
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: add "struct g_lock" without tallocVolker Lendecke2017-07-251-0/+89
| | | | | | | Enable handing the g_lock.tdb content without having to talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: simplify g_lock_trylockVolker Lendecke2017-07-251-15/+18
| | | | | | | The now mandatory talloc_realloc_array will go away soon Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: Walk locks only once in g_lock_trylockVolker Lendecke2017-07-251-10/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* g_lock: open with LOCK_ORDER_3Volker Lendecke2017-06-151-1/+1
| | | | | | | | | | | xattr_tdb needs g_lock in a clustered environment. Nobody else uses LOCK_ORDER_3 at this moment, so this looks safe. The last one to use this was dbwrap_watch.tdb, and that's gone. The only other one was notify_index.tdb, and that's gone too. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Heuristically check for server existenceVolker Lendecke2017-06-151-0/+16
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Allow lock upgrade/downgradeVolker Lendecke2017-06-151-14/+31
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Make g_lock_dump return a complete list of locksVolker Lendecke2017-06-151-17/+13
| | | | | | | | | | | | To be honest, it did not really make sense to just pass in lock holders individually. You could argue that it made sense with in reality only G_LOCK_WRITE around, but soon we will have G_LOCK_READ and thus multiple lock holders on a single lock. Now that we also have userdata, change the g_lock_dump API Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Add g_lock_write_dataVolker Lendecke2017-06-151-0/+49
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Make g_lock_record_store also store userdataVolker Lendecke2017-06-151-10/+13
| | | | | | | | Sequel to the previous commit changing the get/put routines for the on-disk format Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Reformat to allow userdataVolker Lendecke2017-06-151-31/+98
| | | | | | | | The next patches will make g_locks carry data. This prepares the on-disk format. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Move parsing routines togetherVolker Lendecke2017-06-151-54/+54
| | | | | | | | | | No code change, just shuffling around: Before this patchset, g_lock_parse was somewhere in the middle. This carries no real logic, put it on top. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: unparse->putVolker Lendecke2017-06-151-5/+5
| | | | | | | Make it more in line with server_id_get/put Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: parse->getVolker Lendecke2017-06-151-7/+7
| | | | | | | Make it more in line with server_id_get/put Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Remove a pointless "else"Volker Lendecke2017-06-151-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Remove unused g_lock_getVolker Lendecke2017-06-151-33/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Make it endian-neutralVolker Lendecke2017-06-151-13/+85
| | | | | | | Add explicit parsing Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: More correct error msgVolker Lendecke2017-06-151-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Fix two typosVolker Lendecke2017-06-151-3/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: Add lib/util/server_id.hVolker Lendecke2017-01-221-0/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* lib: Convert g_lock to new dbwrap_watchVolker Lendecke2016-07-151-13/+18
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Use "blocker" argument to dbwrap_record_watch_sendVolker Lendecke2016-07-151-8/+9
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: Add "blocker" to record_watch_sendVolker Lendecke2016-07-151-3/+6
| | | | | | | | | | Typicall, when we watch a record, we wait for a process to give up some resource. Be it an oplock, a share mode or the g_lock. If everything goes well, the blocker sends us a message. If the blocker dies hard, we want to also be informed immediately. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* g_lock: Remove some unneeded includesVolker Lendecke2016-03-061-3/+0
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Sun Mar 6 19:34:42 CET 2016 on sn-devel-144
* lib: Avoid an unnecessary castVolker Lendecke2016-02-231-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* g_lock: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-1/+9
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dbwrap: add a dbwrap_flags argument to db_open()Michael Adam2014-02-071-1/+2
| | | | | | | | | | This is in preparation to support handing flags to backends, in particular activating read only record support for ctdb databases. For a start, this does nothing but adding the parameter, and all databases use DBWRAP_FLAG_NONE. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:lib: make use of samba_tevent_context_init()Stefan Metzmacher2013-02-191-2/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:g_lock: use serverid_exists() with SERVERID_UNIQUE_ID_NOT_TO_VERIFYStefan Metzmacher2012-08-241-1/+10
| | | | metze
* s3-g_lock: Make g_lock_lock more robustVolker Lendecke2012-08-161-0/+24
| | | | | | | | | | | | If for some reason the cleanup of dbwrap_watch_send does not work properly, we might starve indefinitely. Make the lock routine more robust by retrying every 5-10 seconds. g_lock_trylock will clean up orphaned entries. Signed-off-by: Christian Ambach <ambi@samba.org> Autobuild-User(master): Christian Ambach <ambi@samba.org> Autobuild-Date(master): Thu Aug 16 19:44:00 CEST 2012 on sn-devel-104