summaryrefslogtreecommitdiffstats
path: root/source3/locking/brlock.c
Commit message (Collapse)AuthorAgeFilesLines
* dbwrap: add a dbwrap_flags argument to db_open()Michael Adam2014-02-071-1/+1
| | | | | | | | | | 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>
* param: Complete the removal of the "open files database hash size" parameterGarming Sam2014-01-311-1/+1
| | | | | | | | This parameter was originally set for removal in 2007 in 28210588edc39eb2b6cd237f11b488fa4d6b6985 Signed-off-by: Garming Sam <garming@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:brlock: fix a comment typoMichael Adam2014-01-301-1/+1
| | | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Thu Jan 30 13:25:22 CET 2014 on sn-devel-104
* smbd: Early exitVolker Lendecke2013-12-141-1/+7
| | | | | | | Yes, this also showed up in profiles Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix CID 1035434 Same on both sidesVolker Lendecke2013-11-111-1/+1
| | | | | | | Looks scary, but the only effect of this bug is too many UNLOCK messages Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
* smbd: Add debugs to brlock.cVolker Lendecke2013-10-151-0/+15
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Put "have_read_oplocks" into brlock.tdbVolker Lendecke2013-10-151-10/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements an idea by metze: Right now Samba does not grant level2 oplocks where it should: After an initial no-oplock open that has been written to, we don't have the FAKE_LEVEL2_OPLOCK entry in locking.tdb around anymore, this downgraded to NO_OPLOCK. Windows in this case will grant level2 if being asked, we don't. Part of the reason for this is that we don't have a proper mechanism to communicate the fact that level2 needs to be broken to other smbds. Metze's insight was that we have to look into brlock.tdb for every write anyway, so this might be the right place to store this information. My first reaction was that this is really hackish, but on further thought this is not. oplocks depend on brlocks anyway, and we have the proper mechanisms in place for brlocks. The format for this change is to add one byte to the end of the brlock.tdb record with value 1 if we have level2 oplocks around. Thus this patch effectively reverts 8f41142 which I discovered while writing this change. We now legally have unaligned records. We can certainly talk about the format, but I'm not yet convinced we need an idl for this yet. This is a potentially very hot code path, and ndr marshalling has a cost. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove byte_range_lock->read_onlyVolker Lendecke2013-10-061-10/+0
| | | | | | | | | | | With the rewritten brl_get_lock_readonly we only set the destructor for r/w lock records anyway. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Oct 6 22:20:05 CEST 2013 on sn-devel-104
* smbd: Remove the brl_get_locks wrapperVolker Lendecke2013-10-061-9/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: brl_get_locks_internal is always called r/w nowVolker Lendecke2013-10-061-37/+11
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Restructure brl_get_locks_readonlyVolker Lendecke2013-10-061-10/+103
| | | | | | | | | | | | This is step 1 to get rid of brl_get_locks_internal with its complex readonly business. It also optimizes 2 things: First, it uses dbwrap_parse_record to avoid a talloc and memcpy, and second it uses talloc_pooled_object. And -- hopefully it is easier to understand the caching logic with fsp->brlock_rec and the clustering escape. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Avoid an if-statement per read/write in the non-clustered caseVolker Lendecke2013-10-061-4/+4
| | | | | | | | | | | Without clustering, fsp->brlock_rec will never be set anyway. In the clustering case we can't use the seqnum trick, so this is slow enough that the additional if-statement does not matter in this case anyway. In the non-clustered case it might. Have not measured it, but every little bit helps I guess. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Remove unused "brl->key" struct elementVolker Lendecke2013-10-061-3/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Sun Oct 6 15:49:43 CEST 2013 on sn-devel-104
* smbd: Properly protect against invalid lock dataVolker Lendecke2013-09-121-0/+6
| | | | | | | | | | | If someone messes with brlock.tdb and inserts an invalid record length, this will lead to memcpy overwriting a few bytes behind malloc'ed data. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Sep 12 03:26:45 CEST 2013 on sn-devel-104
* smbd: Convert br_lck->lock_data to tallocVolker Lendecke2013-09-111-26/+29
| | | | | Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Sep 11 10:15:38 CEST 2013 on sn-devel-104
* smbd: Move "struct byte_range_lock" definition to brlock.cVolker Lendecke2013-09-111-0/+10
|
* smbd: Add brl_fsp access functionVolker Lendecke2013-09-111-0/+5
|
* smbd: Add brl_num_locks access functionVolker Lendecke2013-09-111-0/+5
|
* smbd: Use ZERO_STRUCT instead of memsetVolker Lendecke2013-09-111-1/+1
|
* smbd: Make brl_lock_failed staticVolker Lendecke2013-09-111-1/+3
|
* smbd: Make brl_same_context staticVolker Lendecke2013-09-111-1/+1
|
* smbd: Fix blank line endingsVolker Lendecke2013-09-111-19/+19
|
* s3:locking:brlock: add function brl_cleanup_disconnected()Gregor Beck2013-04-181-0/+73
| | | | | | | | For a given file, clean up brl entries belonging to a given persistent file id. Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking:brlock: explain the lockdb_clean semantic better in ↵Michael Adam2013-04-181-1/+5
| | | | | | | | brl_reconnect_disconnected() Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking:brlock: let validate_lock_entries keep entries for disconnected ↵Gregor Beck2013-04-181-8/+23
| | | | | | | | | | | | | servers in traverses We should not remove locks of disconnected opens just like that. When getting the byte range lock record for a newly connected file handle, we still do the clean up, because in that situation, disconnected entries are not valid any more. Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking:brlock: improve the comment for the brl self cleaning codeMichael Adam2013-04-181-3/+6
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking:brlock: use serverids_exist to validate_lock_entriesGregor Beck2013-04-181-3/+34
| | | | | | | | | ...instead of checking each server-id separately which can be expensive in a cluster. Signed-off-by: Gregor Beck <gbeck@sernet.de> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* brlock.c: Fix typo in comment.Karolin Seeger2013-02-181-1/+1
| | | | | | redundent -> redundant Signed-off-by: Karolin Seeger <kseeger@samba.org>
* s3:locking: add brl_mark_disconnected() and brl_reconnect_disconnected()Stefan Metzmacher2012-09-081-0/+125
| | | | Pair-Programmed-With: Michael Adam <obnox@samba.org>
* s3:locking: fix trailing space in brl_close_fnum()Michael Adam2012-09-051-1/+1
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:brlock: give traverse_fn a proper nameChristian Ambach2012-08-161-2/+2
|
* s3:brlock: s/int/uint64_t for fnumStefan Metzmacher2012-06-281-1/+1
| | | | | | | | | | | | | | | fsp->fnum and lock->fnum are uint64_t already and we should not truncate the value here. Currently this doesn't matter as we only use 16-bit. But as 'int' is int32_t and we later compare fnum with lock->fnum == fnum, the cast from int32_t to uint64_t goes via int64_t instead of uint32_t. This means even if fsp->fnum just uses 32-bit of the uint64_t we'll get the wrong result, as the implicit cast from a negative int32_t value to uint64_t adds 0xFFFFFFFF00000000. metze
* s3:brlock: add some const to print_lock_struct()Stefan Metzmacher2012-06-281-1/+1
| | | | metze
* s3:util: rename procid_equal() to serverid_equal()Michael Adam2012-06-211-4/+4
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: change brlock.c to use fsp_fnum_dbg() for fsp->fnum logging.Michael Adam2012-06-151-4/+4
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:include: change lock_struct->fnum to uint64_tMichael Adam2012-06-061-2/+2
| | | | | | | | | Note: this changes the format of brlock.tdb! Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Autobuild-User: Michael Adam <obnox@samba.org> Autobuild-Date: Wed Jun 6 23:22:00 CEST 2012 on sn-devel-104
* s3:include: change connection_struct->cnum to uint32_tMichael Adam2012-06-061-1/+1
| | | | Pair-Programmed-With: Stefan Metzmacher <metze@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:locking: avoid using sconn_server_id()Stefan Metzmacher2011-12-161-1/+1
| | | | metze
* s3:smbd: remove brl_register_msgs()Stefan Metzmacher2011-12-141-11/+5
| | | | metze
* vfs: Make function pointer names consistent. They all end in _fnRichard Sharpe2011-12-121-4/+5
| | | | | Autobuild-User: Richard Sharpe <sharpe@samba.org> Autobuild-Date: Mon Dec 12 04:58:40 CET 2011 on sn-devel-104
* s3:locking: convert brlock to only use dbwrap wrapper functionsMichael Adam2011-10-111-15/+28
| | | | Avoid direct use of the db_record and db_context structs.
* 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.
* Fix bug #8307 - brl_close_fnum does not call SMB_VFS_BRL_UNLOCK_WINDOWS on ↵Jeremy Allison2011-07-161-122/+23
| | | | | | | | | | all locks Reported by herb@samba.org. Remove the (premature) optimization on file close. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Jul 16 02:32:02 CEST 2011 on sn-devel-104
* tdb_compat: Higher level API fixes.Rusty Russell2011-06-201-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>
* lib/util Bring procid_str() into lib/util as server_id_string()Andrew Bartlett2011-06-091-1/+1
| | | | | | | This is needed for OpenChange, which prints Samba struct server_id values in debug messages. Andrew Bartlett
* s3-talloc Change TALLOC_MEMDUP() to talloc_memdup()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_MEMDUP isn't standard talloc.
* s3-talloc Change TALLOC_ZERO_P() to talloc_zero()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc.
* s3-talloc Change TALLOC_P() to talloc()Andrew Bartlett2011-06-091-1/+1
| | | | | Using the standard macro makes it easier to move code into common, as TALLOC_P isn't standard talloc.