summaryrefslogtreecommitdiff
path: root/source3/lib/serverid.c
AgeCommit message (Collapse)AuthorFilesLines
2012-03-10tdb_wrap: Move to specific directory.Jelmer Vernooij1-1/+1
It's a bit confusing to mix low-level and high-level libraries. We had multiple libraries in one directory, and there were have circular dependencies with other libraries outside that directory (in this case, samba-hostconfig). Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Mar 10 23:13:01 CET 2012 on sn-devel-104
2012-02-15s3: Add SERVERID_UNIQUE_ID_NOT_TO_VERIFY, bug 8760Volker Lendecke1-0/+20
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 15 21:10:22 CET 2012 on sn-devel-104
2012-01-18s3: Add a "lock_order" argument to db_openVolker Lendecke1-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.
2011-12-15s3-dbwrap: Make dbwrap_parse_record return NTSTATUSVolker Lendecke1-4/+6
Also, the parser now returns void. The parser is called if and only if dbwrap_parse_record returns NT_STATUS_OK. Signed-off-by: Michael Adam <obnox@samba.org>
2011-11-30s3-ctdb: Make use of CTDB_CONTROL_CHECK_SRVIDSVolker Lendecke1-0/+13
This should be a lot quicker than PROCESS_EXISTS followed by looking at serverid.tdb Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Wed Nov 30 12:47:27 CET 2011 on sn-devel-104
2011-10-27s3: Add serverids_existVolker Lendecke1-0/+34
2011-10-13lib/util: Add back control of mmap and hash size in tdb for top level buildAndrew Bartlett1-1/+10
This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett
2011-10-11s3:serverid: convert to using dbwrap wrapper functions onlyMichael Adam1-16/+24
Avoid direct use of the db_record and db_context structs.
2011-10-11s3:serverid: use dbwrap_traverse_read() in serverid_traverse_read()Michael Adam1-1/+5
This also fixes the return value: originally the int return value of traverse_read which is a count of the records traversed or negative upon failure, was simply casted into a bool return value.
2011-10-11s3:serverid: use dbwrap_traverse() in serverid_traverse()Michael Adam1-1/+4
This also fixes the return value: Originally, the int returned by the traverse method, which is the count of the traverse was casted into a bool return value.
2011-08-22s3: Slightly simplify serverid_existsVolker Lendecke1-1/+1
procid_is_me() works fine in the clustering case as well Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Mon Aug 22 21:28:13 CEST 2011 on sn-devel-104
2011-08-20Re-arrange the optimization to reduce tdb fcntl calls if smbd is notIra Cooper1-1/+5
clustered. procid_is_me() is much cheaper to test and can optimize up to 50% of the calls to serverid_exists(). Volker please check. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Aug 20 01:15:07 CEST 2011 on sn-devel-104
2011-07-29s3:dbwrap: move all .c and .h files of dbwrap to lib/dbwrap/Michael Adam1-1/+1
Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Fri Jul 29 13:34:22 CEST 2011 on sn-devel-104
2011-07-29s3:dbwrap: move db_open() to a file dbwrap_open.c of its own.Michael Adam1-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.
2011-06-20tdb_compat: Higher level API fixes.Rusty Russell1-1/+1
My previous patches fixed up all direct TDB callers, but there are a few utility functions and the db_context functions which are still using the old -1 / 0 return codes. It's clearer to fix up all the callers of these too, so everywhere is consistent: non-zero means an error. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-06-09s3-server_id Add task_id to server_id to match Samba4Andrew Bartlett1-0/+3
This will allow this structure to be shared, and allow us to create a common messaging system between all Samba processes. Samba4 uses the task_id to indicate the different tasks within a single unix process. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-05-06s3: only include tdb headers where needed.Günther Deschner1-0/+1
Guenther
2011-05-06lib/util Move source3 tdb_wrap_open() into the common code.Andrew Bartlett1-0/+1
This #if _SAMBA_BUILD == 3 is very unfortunate, as it means that in the top level build, these options are not available for these databases. However, having two different tdb_wrap lists is a worse fate, so this will do for now. Andrew Bartlett
2011-03-30s3-includes: only include system/filesys.h when needed.Günther Deschner1-0/+1
Guenther
2011-02-17s3-cluster Always fill in the clustering vnn elementAndrew Bartlett1-6/+0
This avoids this structure being partially uninitialised. Adnrew Bartlett
2010-12-19s3: Fix serverid_existsVolker Lendecke1-0/+4
In the cluster case it can happen that a node just died and we did not yet have the time to clean up serverid.tdb. If the corresponding serverid.tdb record that represented a process was migrated away from the dead record, it represents existence of a process where it is already dead.
2010-09-27Change to using TDB_INCOMPATIBLE_HASH (the jenkins hash) on allJeremy Allison1-2/+2
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.
2010-09-26s3: Remove talloc_autofree_context() from serverid_db()Volker Lendecke1-2/+2
If we needed an explicit tdb_close() in the destructor, we'd be hosed long ago.
2010-09-26s3: Remove talloc_autofree_context() from serverid_parent_init()Volker Lendecke1-3/+2
2010-08-26s3-build: use dbwrap.h only where needed.Günther Deschner1-0/+1
Guenther
2010-08-18s3: Fix serverid_register_msg_flagsVolker Lendecke1-4/+2
Thanks, Andreas, for pointing this out! (How drunk have I been?...)
2010-08-18s3-lib: Fixed a possible crash bug.Andreas Schneider1-0/+2
Volker please check!
2010-07-20Fix warning on 64-bit machines.Jeremy Allison1-1/+1
Jeremy.
2010-07-05s3: Put serverid_key and serverid_data togetherVolker Lendecke1-5/+5
2010-07-04s3: Remove an unused variable -- thanks, metze!Volker Lendecke1-2/+1
2010-07-04s3: Replace register_message_flags() with serverid_register_msg_flags()Volker Lendecke1-0/+52
message_send_all is now done by walking the serverid.tdb, not the connections.tdb anymore. Günther, Simo, please check!
2010-07-04s3: Remove serverid_[de]register_selfVolker Lendecke1-21/+5
This removes some deep references to procid_self()
2010-07-04s3: ALWAYS run make test before checkin ....Volker Lendecke1-2/+2
2010-07-04s3: Slight reshaping of server_exists_parseVolker Lendecke1-4/+6
Doing a copy and then do the compare is a bit pointless, use memcmp
2010-03-25s3: Add a comment to serverid_parent_init, this is pretty confusingVolker Lendecke1-0/+6
2010-03-25s3: Make sure our CLEAR_IF_FIRST optimization works for serverid.tdbVolker Lendecke1-0/+16
In the child, we fully re-open serverid.tdb, which leads to one fcntl lock for CLEAR_IF_FIRST detection per smbd. This opens the tdb in the parent and holds it, so that tdb_reopen_all correctly catches the CLEAR_IF_FIRST bit.
2010-03-10s3: Fix a long-standing problem with recycled PIDsVolker Lendecke1-0/+293
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