summaryrefslogtreecommitdiffstats
path: root/source3/locking
Commit message (Collapse)AuthorAgeFilesLines
* leases_db: don't leak lock_path onto talloc tosDavid Disseldorp2015-01-121-2/+9
| | | | | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jan 12 19:22:31 CET 2015 on sn-devel-104
* smbd: Fix a small leak on talloc_tos()Volker Lendecke2015-01-111-1/+1
| | | | | | | | 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): Sun Jan 11 20:34:56 CET 2015 on sn-devel-104
* smbd: Fix an uninitialized variable readVolker Lendecke2015-01-111-2/+1
| | | | | | | | If dbwrap_fetch_locked failed, we did a TALLOC_FREE(value). Fix this with a talloc hierarchy. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:locking: fix uninitialiazed variable in brl_get_locks_readonly_parser()Stefan Metzmacher2014-12-181-0/+1
| | | | | | | | | | | | | In a cluster this can be called with an empty record, while brl_parse_data() relies on an initialized structure. This is a regression in commit 837e29035c911f3509135252c3f423d0f56b606d. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10911 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:locking: Change the data model for leases_db to cope with dynamic path ↵Jeremy Allison2014-12-092-31/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | renames. interface leases_db { typedef [public] struct { GUID client_guid; smb2_lease_key lease_key; } leases_db_key; typedef [public] struct { file_id id; [string,charset(UTF8)] char *servicepath; [string,charset(UTF8)] char *base_name; [string,charset(UTF8)] char *stream_name; } leases_db_file; typedef [public] struct { uint32 num_files; [size_is(num_files)] leases_db_file files[]; } leases_db_value; } As designed by metze. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Dec 9 03:44:04 CET 2014 on sn-devel-104
* s3:locking: pass down servicepath to leases_db_add()Jeremy Allison2014-12-092-0/+3
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: Add new utility function leases_db_copy_file_ids()Jeremy Allison2014-12-092-0/+25
| | | | | | | Will be used by lease db parsers. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: pass servicename_new to leases_db_rename()Jeremy Allison2014-12-093-0/+3
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3: leases : Cope with renaming leased open files.Jeremy Allison2014-12-051-1/+24
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3: leases: Add leases_db_rename() to cope with renaming a leased file.Jeremy Allison2014-12-052-1/+27
| | | | | Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: add downgrade_share_lease() helper functionVolker Lendecke2014-12-042-0/+86
| | | | | | | | | Pair-Programmed-With: Jeremy Allison <jra@samba.org> Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: cleanup leases_db from share_mode_cleanup_disconnected()Stefan Metzmacher2014-12-041-0/+12
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:locking: ensure all share mode removal functions go through a common ↵Jeremy Allison2014-12-041-3/+88
| | | | | | | | | lease refcount manager. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:open_files.idl: add data structures for SMB2.1 and SMB3.0 leases.Stefan Metzmacher2014-12-043-5/+29
| | | | | | | Pair-Programmed-With: Volker Lendecke <vl@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: add leases_db infrastructureVolker Lendecke2014-12-042-0/+433
| | | | | | | | | | | | | | Will enable us to solve the dynamic share path problem with leases on [homes]. We're also able to give the correct error codes when a lease key is re-used with a different file name. Pair-Programmed-With: Jeremy Allison <jra@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: convert brl_have_read field to brl_num_read.Volker Lendecke2014-11-112-70/+59
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* share_mode_lock: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-2/+9
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* brlock: don't leak lock_path onto talloc tosDavid Disseldorp2014-11-031-2/+11
| | | | | | | Also check for allocation failures. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3:locking: remove dead code from brl_get_locks_readonly()Stefan Metzmacher2014-10-311-50/+28
| | | | | | | | | | | | | | | struct byte_range_lock *rw = NULL; will never change... commit 105724073300af03eb0835b3c93d9b2e2bfacb07 removed the possible assigment of 'rw'. So we can remove all code under if (rw != NULL) { ... Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 31 06:07:43 CET 2014 on sn-devel-104
* s3:locking: Change from ndr_pull_struct_blob() to ndr_pull_struct_blob_all() ↵Volker Lendecke2014-10-311-2/+2
| | | | | | | | so we fail if not all bytes are consumed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: allow early return for share_entry_forall()Volker Lendecke2014-10-312-11/+16
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: Introduce share_mode_forallVolker Lendecke2014-10-312-28/+68
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s3:locking: Rename share_mode_forall->share_entry_forallVolker Lendecke2014-10-312-4/+4
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* brlock: Remove validate_lock_entriesVolker Lendecke2014-08-231-94/+1
| | | | | | | | | This is now only called during brl_forall. It does not really hurt if we list dead processes here. If the upper layers really care, they can filter it out themselves. The real lock conflicts are not removed on-demand. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* brlock: Do auto-cleanup at conflict timeVolker Lendecke2014-08-233-47/+57
| | | | | | | 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>
* locking: posix_lock_list does not use "fsp"Volker Lendecke2014-08-061-4/+0
| | | | | | | | 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): Wed Aug 6 03:27:36 CEST 2014 on sn-devel-104
* locking: Avoid a pointless castVolker Lendecke2014-08-061-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify brl_locktestVolker Lendecke2014-07-223-33/+16
| | | | | | | | 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: Restructure brl_conflict_otherVolker Lendecke2014-07-221-14/+39
| | | | | | | | It took me really long to grasp what's going on in this routine. I hope its logic is easier to understand now Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Fix indentation, {} and line length in brl_conflict_otherVolker Lendecke2014-07-221-6/+14
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Rename lck2->rw_probe in brl_conflict_otherVolker Lendecke2014-07-221-8/+8
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Rename lck1->lock in brl_conflict_otherVolker Lendecke2014-07-221-8/+8
| | | | | | | | lck1 and lck2 are treated differently. They should carry more descriptive names. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* smbd: Use a struct initializer brl_lockVolker Lendecke2014-07-221-13/+10
| | | | | | | Avoids a #ifdef DEVELOPER and saves a few bytes .text 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-223-79/+120
| | | | | | | 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-042-4/+2
| | | | | | | | 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-043-6/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove unused blocking_lock_record* from VFS_BRL_CANCEL_WINDOWSVolker Lendecke2014-07-041-4/+3
| | | | | 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-042-4/+2
| | | | | 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-043-6/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove unused blocking_lock_record* from VFS_BRL_LOCK_WINDOWSVolker Lendecke2014-07-041-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Use brl_delete_lock_struct in brl_lock_cancel_defaultVolker Lendecke2014-07-041-6/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s3: smbd: Locking, fix off-by one calculation in brl_pending_overlap().Jeremy Allison2014-07-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider: lock = start=110,size=10 pend_lock = 100, size=10 Do not overlap. However, (lock->start <= pend_lock->start + pend_lock->size) 110 100 10 is true, so it returns true (overlap). lock->start <= pend_lock->start + pend_lock->size should be: lock->start < pend_lock->start + pend_lock->size BUG: https://bugzilla.samba.org/show_bug.cgi?id=10685 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Wed Jul 2 10:18:17 CEST 2014 on sn-devel-104
* smbd: validate_lock_entries does not need mem_ctx anymoreVolker Lendecke2014-06-301-4/+3
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify validate_lock_entriesVolker Lendecke2014-06-301-36/+10
| | | | Signed-off-by: Volker Lendecke <vl@samba.org>
* smbd: Factor out brl_delete_lock_structVolker Lendecke2014-06-301-6/+12
| | | | | | | | memmove calculations are never nice, and this is going to be used in validate_lock_entries soon :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify validate_lock_entriesVolker Lendecke2014-06-301-10/+11
| | | | | | | ... saves >100 bytes object code :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbstatus: Fix an uninitialized variableVolker Lendecke2014-06-301-0/+1
| | | | | | | | | | We only print valid share mode entries, stale ones don't count. In traverse, let the callback decide about staleness. https://bugzilla.samba.org/show_bug.cgi?id=10680 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-132-8/+9
| | | | | | | | | | | | 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>
* s3 : smbd : Protect all possible code paths from fsp->op == NULL.Jeremy Allison2014-05-021-2/+14
| | | | | | | | | | | | | In changes to come this will be possible for an INTERNAL_OPEN_ONLY. The protection was already in place for some code paths, this makes the coverage compete. Bug 10564 - Lock order violation and file lost https://bugzilla.samba.org/show_bug.cgi?id=10564 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>