summaryrefslogtreecommitdiffstats
path: root/source3/locking/brlock.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* s3: Fix some nonempty blank linesVolker Lendecke2011-05-281-6/+6
|
* More simple const fixes.Jeremy Allison2011-05-051-2/+2
|
* 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-locking: move locking prototypes out of proto.h.Günther Deschner2011-03-301-0/+1
| | | | | | Will later become part of locking.h Guenther
* s3-includes: only include system/filesys.h when needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* s3:locking: simplify the non cluster case of brl_get_locks_readonly()Stefan Metzmacher2011-03-181-21/+2
| | | | | | | | | Pair-Programmed-With: Michael Adam <obnox@samba.org> metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri Mar 18 13:00:51 CET 2011 on sn-devel-104
* s3:locking: brl_get_locks_internal() should not expose a write lock if the ↵Stefan Metzmacher2011-03-181-7/+24
| | | | | | | | | | caller wants read_only This triggered deadlocks in the cluster case of brl_get_locks_readonly(). Pair-Programmed-With: Michael Adam <obnox@samba.org> metze
* s3-server_id: only include server_id where needed.Günther Deschner2011-03-021-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: use dbwrap.h only where needed.Günther Deschner2010-08-261-0/+1
| | | | Guenther
* s3: Remove procid_self() from brl_close_fnum()Volker Lendecke2010-07-051-1/+2
|
* This patch looks bigger than it is. It does 2 things. 1). Renames smbpid -> ↵Jeremy Allison2010-05-071-26/+26
| | | | | | smblctx in our locking code. 2). Widens smblctx to 64-bits internally. Preparing to use the SMB2 handle as the locking context. Jeremy.
* Fix SMB2 lock tests up to cancel-by-close.Jeremy Allison2010-05-061-0/+4
| | | | Jeremy.
* Move to MS-FSA algorithm when checking for invalid lock range.Jeremy Allison2010-05-051-7/+6
| | | | | | Satisfies SMB and SMB2. Jeremy.
* 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: Fix a long-standing problem with recycled PIDsVolker Lendecke2010-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* s3-locking: convert brlock to TYPESAFE_QSORT()Andrew Tridgell2010-02-141-3/+2
|
* Make Samba3 pass the RAW-LOCK test as Windows.Jeremy Allison2009-12-041-0/+5
| | | | | | | Implement the win7 NT_STATUS_INVALID_LOCK_RANGE. Make smbd behave as Windows does in canceling locks. Jeremy.
* s3: Remove a pointless memsetVolker Lendecke2009-11-211-1/+0
| | | | | We are assigning the complete structure now (we used to assign individual fields), so this is obsolete.
* s3: Cache brlock.tdb entries for the fast read&write strict locking code pathVolker Lendecke2009-11-211-5/+57
| | | | | For a netbench run this gains around 2% user-space CPU, fetching a 100MB file takes around 4% less.
* s3: Remove debug_ctx()Volker Lendecke2009-11-031-1/+1
| | | | | | | | smbd just crashed on me: In a debug message I called a routine preparing a string that itself used debug_ctx. The outer routine also used it after the inner routine had returned. It was still referencing the talloc context that the outer debug_ctx() had given us, which the inner DEBUG had already freed.
* Fix bug 6776 - Running overlapping Byte Lock test will core dump Samba daemon.Jeremy Allison2009-10-051-148/+219
| | | | | Re-write core of POSIX locking logic. Jeremy.
* Make the smbd VFS typesafeVolker Lendecke2009-07-241-0/+30
|
* s3: Change fsp->fsp_name to be an smb_filename struct!Tim Prouty2009-07-201-2/+2
|
* Use procid_str in debug messages for better cluster-debuggabilityVolker Lendecke2009-04-031-2/+2
|
* s3 BRL: Add more clarifying comments and add implied logic to make ↵Zack Kirsch2009-02-201-2/+6
| | | | conditional more clear
* Add VFS ops for Windows BRL: Lock, Unlock and Cancel:Zack Kirsch2009-02-131-19/+47
| | | | | | | | | | | | | | | | | | | | | | | This patch adds 3 new VFS OPs for Windows byte range locking: BRL_LOCK_WINDOWS, BRL_UNLOCK_WINDOWS and BRL_CANCEL_WINDOWS. Specifically: * I renamed brl_lock_windows, brl_unlock_windows and brl_lock_cancel to *_default as the default implementations of the VFS ops. * The blocking_lock_record (BLR) is now passed into the brl_lock_windows and brl_cancel_windows paths. The Onefs implementation uses it - future implementations may find it useful too. * Created brl_lock_cancel to do what brl_lock/brl_unlock do: set up a lock_struct and call either the Posix or Windows lock function. These happen to be the same for the default implementation. * Added helper functions: increment_current_lock_count() and decrement_current_lock_count(). * Minor spelling correction in brl_timeout_fn: brl -> blr. * Changed blocking_lock_cancel() to return the BLR that it has cancelled. This allows us to assert its the lock that we wanted to cancel. If this assert ever fires, this path will need to take in the BLR to cancel, rather than choosing on its own. * Adds a small helper function: find_blocking_lock_record_by_id(). Used by the OneFS implementation, but could be useful for others.
* Fix an uninitialized variable. Tim, please check!Volker Lendecke2009-02-101-1/+1
|
* s3 oplocks: Make the level2 oplock contention API more granularTim Prouty2009-02-091-11/+74
| | | | | | | | | | | | | | | | | | This replaces release_level2_oplocks_on_change with contend_level2_oplock_begin/end in order to contend level2 oplocks throughout an operation rather than just at the begining. This is necessary for some kernel oplock implementations, and also lays the groundwork for better correctness in Samba's standard level2 oplock handling. The next step for non-kernel oplocks is to add additional state to the share mode lock struct that prevents any new opens from granting oplocks while a contending operation is in progress. All operations that contend level 2 oplocks are now correctly spanned except for aio and synchronous writes. The two write paths both have non-trivial error paths that need extra care to get right. RAW-OPLOCK and the rest of 'make test' are still passing with this change.
* Quieten valgrind message on make valgrindtest. This doesn'tJeremy Allison2008-04-111-0/+5
| | | | | | seem to be valid (vl - feel free to confirm). Jeremy. (This used to be commit 43b0254d93540eeaddaa32d76dd9271f4dc2ebff)
* Merge leftovers of 0e1a86bc845 in 3-0-ctdbVolker Lendecke2008-03-171-1/+1
| | | | (This used to be commit 64b1625f8e3bca43504871747bef6631e1b18f44)
* Fix some "set but never used" warningsVolker Lendecke2008-01-201-5/+0
| | | | (This used to be commit 4a6dadc5178f4861e9c032321939db3b639734b5)
* Merge CTDB-related fixes from samba-ctdb 3.0 branch ↵Alexander Bokovoy2008-01-161-14/+15
| | | | | | (http://samba.org/~tridge/3_0-ctdb) Signed-off-by: Alexander Bokovoy <ab@samba.org>(This used to be commit 0c8e23afbbb2d081fc23908bafcad04650bfacea)
* Tiny simplificationsVolker Lendecke2007-12-101-5/+2
| | | | | | | locking.c:open_read_only was unused don't export the silly boolean flag locking_init(bool read_only) (This used to be commit 2f3c865707010bc7c463a02782dbee3dc2479da1)
* RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison2007-10-181-28/+28
| | | | | | | | bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
* r25055: Add file_id_string_tosVolker Lendecke2007-10-101-1/+1
| | | | | This removes file_id_string_static and file_id_string_static2 (This used to be commit 638c848c9afe374feb30e34c494f89b2a6c64f7b)
* r24266: Remove the "open files database hash size" parameterVolker Lendecke2007-10-101-2/+1
| | | | | This has been superseded by the "tdb_hashsize:<tdbname>" parameter (This used to be commit df40d336afd256f05a0ec3724cc2096fb7114d81)
* r24034: Print the full cluster pid in print_lock_structVolker Lendecke2007-10-101-2/+2
| | | | (This used to be commit ff1996ce4b0edfee90758c85ea0ac653877a1b9f)
* r23885: Fix make test on opi.Volker Lendecke2007-10-101-0/+1
| | | | (This used to be commit b2adb28808fe25d420bc12834ca8bc70779bb653)
* r23882: Fix Coverity id 389 -- finally (I hope)Volker Lendecke2007-10-101-7/+11
| | | | (This used to be commit 9b8f2d8bd144700306819480bcb260d2c20969ae)
* r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell2007-10-101-2/+1
| | | | (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)