summaryrefslogtreecommitdiffstats
path: root/source3/locking/locking.c
Commit message (Collapse)AuthorAgeFilesLines
* brlock: Do auto-cleanup at conflict timeVolker Lendecke2014-08-231-0/+10
| | | | | | | This avoids the need to do sweeping validate_lock_entries calls Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify brl_locktestVolker Lendecke2014-07-221-7/+1
| | | | | | | | Pass "struct lock_struct" as a parameter. This had to be destructured before the call and re-constructed inside brl_locktest. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Simplify strict_lock_default with early returnsVolker Lendecke2014-07-221-34/+24
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Use %ju/uintmax_t in source3/lockingVolker Lendecke2014-07-221-12/+12
| | | | | | | Avoid going through (double) and %.0f Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: do_lock_cancel does not need "blr" anymoreVolker Lendecke2014-07-041-2/+1
| | | | | | | | 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): Fri Jul 4 08:52:31 CEST 2014 on sn-devel-104
* smbd: brl_lock_cancel does not need "blr" anymoreVolker Lendecke2014-07-041-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: do_lock does not need "blr" anymoreVolker Lendecke2014-07-041-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: brl_lock does not need "blr" anymoreVolker Lendecke2014-07-041-2/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* locking: use correct conversion specifier for printing variablesRalph Boehme2014-06-131-2/+2
| | | | | | | | | | | | Fix several occurences of using printf conversion to fload when printing offset and count variables in locking debug messages and smbstatus. Conversion to float may lead to wrong results with very large values. Signed-off-by: Ralph Boehme <rb@sernet.de> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Explicitly pass "file_id" to rename_share_filenameVolker Lendecke2014-03-211-2/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Factor out get_share_mode_write_time of get_file_infosVolker Lendecke2013-11-221-8/+11
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Factor out remove_stale_share_mode_entriesVolker Lendecke2013-10-151-0/+16
| | | | | | | Will be used in the next commit Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Remove FAKE_LEVEL_II_OPLOCKVolker Lendecke2013-10-151-13/+1
| | | | | | | | | FAKE_LEVEL_II_OPLOCK was an indicator to break level2 oplock holders on write. This information is now being held in brlock.tdb, which makes the FAKE_LEVEL_II_OPLOCK type unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify set_share_modeVolker Lendecke2013-10-081-30/+15
| | | | | | | | With the find_share_mode simplification we don't need fill_share_mode anymore. So this coalesces add_share_mode as well. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify find_share_mode_entry callersVolker Lendecke2013-10-081-46/+25
| | | | | | | | All callers used fill_share_mode_entry before calling find_share_mode_entry. Remove that requirement. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Convert set_share_mode to return bool for successVolker Lendecke2013-10-081-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Make add_share_mode return boolVolker Lendecke2013-10-081-4/+13
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Change parameter from unsigned to uint32_tVolker Lendecke2013-10-081-1/+1
| | | | | | | | share_mode_stale_pid internally only has to deal with uint32_t. Make the parameter match this. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Avoid calling serverid_exists twiceVolker Lendecke2013-10-061-0/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix a typoVolker Lendecke2013-09-111-1/+1
|
* smbd: Apply some const to find_share_mode_entryVolker Lendecke2013-09-061-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Apply some const to share_modes_identicalVolker Lendecke2013-09-061-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Simplify find_share_mode_entryVolker Lendecke2013-09-061-2/+5
| | | | | | | | There's no point checking the validity of the "entry" argument more than once Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Fix flawed share_mode_stale_pid APIVolker Lendecke2013-09-031-9/+26
| | | | | | | | | | | | | | | | The comment for this routine said: > Modifies d->num_share_modes, watch out in routines iterating over > that array. Well, it turns out that *every* caller of this API got it wrong. So I think it's better to change the routine. This leaves the array untouched while iterating but filters out the deleted ones while saving them back to disk. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: Rename parameter "i" to "idx"Volker Lendecke2013-09-031-6/+6
| | | | | | | We'll need "i" in a later checkin ... :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* smbd: We don't use DEFERRED_OPEN_ENTRY anymoreVolker Lendecke2013-04-261-61/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:locking: add mark_share_mode_disconnected()Stefan Metzmacher2012-09-081-0/+38
| | | | Pair-Programmed-With: Michael Adam <obnox@samba.org>
* Move copy_unix_token() from locking/locking.c to lib/util.c.Jeremy Allison2012-07-031-29/+0
| | | | Make public.
* s3:util: rename procid_equal() to serverid_equal()Michael Adam2012-06-211-3/+3
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Remove a user of procid_is_meVolker Lendecke2012-06-211-1/+2
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: change locking.c to use fsp_fnum_dbg() for fsp->fnum logging.Michael Adam2012-06-151-8/+8
| | | | 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: Simplify get_delete_on_close_token moreVolker Lendecke2012-06-031-6/+2
| | | | | | All remaining callers actually want the token Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Simplify get_delete_on_close_token slightlyVolker Lendecke2012-06-031-19/+32
| | | | | | | Introduce find_delete_on_close_token. Thus is_delete_on_close_set does not have to call get_delete_on_close_token anymore. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Avoid a lot of calls to serverid_exists()Volker Lendecke2012-06-011-1/+1
| | | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Fri Jun 1 18:58:30 CEST 2012 on sn-devel-104
* s3: Be less picky on stale share mode entriesVolker Lendecke2012-05-251-1/+3
| | | | | | | If a process died, the share mode entry might be bogus. Ignore those entries. Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Check for serverid_exists in rename_share_filenameVolker Lendecke2012-05-251-0/+4
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Fix an invalid state only reachable on server crash/abort.Jeremy Allison2012-05-251-0/+11
| | | | | | | Remove any delete-on-close tokens and clear the count if there are no valid share modes. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Add "share_mode_stale_pid"Volker Lendecke2012-05-251-0/+32
| | | | | | | | This is a helper routine that prunes a dead share mode entry on demand. This prepares for removing the serverids_exist call in parse_share_modes. Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3: Revert the serverid changes, they need more workVolker Lendecke2012-05-181-39/+1
| | | | | Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Fri May 18 13:12:14 CEST 2012 on sn-devel-104
* s3: Be less picky on stale share mode entriesVolker Lendecke2012-05-171-1/+3
| | | | | | If a process died, the share mode entry might be bogus. Ignore those entries. Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Check for serverid_exists in rename_share_filenameVolker Lendecke2012-05-171-0/+4
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Add "share_mode_stale_server"Volker Lendecke2012-05-171-0/+32
| | | | | | | This is a helper routine that prunes a dead share mode entry on demand. This prepares for removing the serverids_exist call in parse_share_modes. Signed-off-by: Jeremy Allison <jra@samba.org>
* Found whilst back-porting the fix for bug 8837 - smbd crashes when deleting ↵Jeremy Allison2012-04-071-9/+10
| | | | | | | | | | | directory and veto files are enabled. The delete tokens are unique to each name hash representing a pathname, if we don't correctly return here we'll add duplicate tokens for a given pasname hash. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Apr 7 02:13:58 CEST 2012 on sn-devel-104
* Second part of bugfix for bug #8837 - smbd crashes when deleting directory ↵Jeremy Allison2012-04-041-8/+43
| | | | | | | and veto files are enabled. Store the 'struct security_token' as well as the 'struct security_unix_token' inside the locking db when setting a delete on close.
* s3: get_share_mode_lock_fresh->get_share_mode_lockVolker Lendecke2012-02-191-1/+1
| | | | | | | get_share_mode_lock_fresh is just a confusing name Autobuild-User: Volker Lendecke <vl@samba.org> Autobuild-Date: Sun Feb 19 19:16:41 CET 2012 on sn-devel-104
* s3: get_share_mode_lock->get_existing_share_mode_lockVolker Lendecke2012-02-191-5/+5
|
* Add comments to all functions (to help me understand it better).Jeremy Allison2012-01-131-0/+5
| | | | | Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Jan 13 01:35:03 CET 2012 on sn-devel-104
* s3: Move the share_mode_lock handling to its own fileVolker Lendecke2012-01-121-415/+0
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>
* s3: Put an indirection layer into share_mode_lockVolker Lendecke2012-01-121-133/+147
| | | | Signed-off-by: Jeremy Allison <jra@samba.org>