summaryrefslogtreecommitdiff
path: root/source3/locking/leases_db.c
AgeCommit message (Collapse)AuthorFilesLines
2024-11-05smbd: ndrprint lease value in leases_db_set_fn()Ralph Boehme1-0/+5
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2022-12-19smbd/locking: make use of the same tdb hash_size and flags for all SMB ↵Stefan Metzmacher1-6/+4
related tdb's It's good to have a consistent set of hash_size/flags for all aspects of an open file handle. Currently we're using 4 databases: smbXsrv_open_global.tdb, leases.tdb, locking.tdb and brlock.tdb. While at it also crank up the hashsize if the smbXsrv_tcon and smbXsrv_session TDBs. The default TDB hash size is insanely small and disk space is cheap these days, by going with the much larger hash size we get O(1) lookup instead of O(n) for moderate to large loads with a few thousand objects. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Dec 19 16:40:15 UTC 2022 on sn-devel-184
2020-07-07s3:leases: log errors with level 0 in leases_db_do_locked_fn()Stefan Metzmacher1-4/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2020-07-02s3/leases: log NDR decoding failure with level 0 in leases_db_get_fn()Ralph Boehme1-2/+2
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14428 Signed-off-by: Ralph Boehme <slow@samba.org>
2019-11-22dbwrap: Pass "value" to dbwrap_do_locked() callbackVolker Lendecke1-2/+4
I want to reduce dbwrap_record_get_value(). It makes the caller believe it can make a copy of the TDB_DATA returned and that the value remains constant. It's not, as you can always do a dbwrap_record_store(). This patch removes one requirement for getting the value out of a db_record via dbwrap_record_get_value(). You can still make a copy, but from an API perspective to me it's more obvious that "value" as a parameter to the callback has a limited lifetime. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-09-17smbd: Allow another database between brlock.tdb and leases.tdbVolker Lendecke1-1/+1
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-09-17smbd: Add quick leases_db_get_current_state()Volker Lendecke1-1/+76
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-14leases_db: Add getter/setter for share_mode_lease metadataVolker Lendecke1-0/+169
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
2019-04-14leases_db: Add share_mode_lease info to leases.tdbVolker Lendecke1-0/+16
This is the data stored in share_mode_lease inside the leases[] array in locking.tdb. This and all the following patches move all leases array to looking at the leases.tdb. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org>
2019-04-09leases_db: Make leases_db_del use leases_db_do_lockedVolker Lendecke1-79/+26
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): Tue Apr 9 19:31:09 UTC 2019 on sn-devel-144
2019-04-09leases_db: Make leases_db_add use leases_db_do_lockedVolker Lendecke1-108/+56
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2019-04-09leases_db: Make leases_db_rename atomicVolker Lendecke1-10/+153
Do the rename under one lock to protect against potential races while we don't hold it. Factor out the NDR marshalling into leases_db_do_locked(), leaving the rename function pretty simple. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2018-10-03leases: Streamline leases_db_key a bitVolker Lendecke1-41/+21
We don't need to talloc the blob, it's always the same size 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 Oct 3 04:11:59 CEST 2018 on sn-devel-144
2018-08-17lib: Pass mem_ctx to lock_path()Volker Lendecke1-1/+1
Fix a confusing API: Many places TALLOC_FREE the path where it's not clear you have to do it. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2015-01-12leases_db: don't leak lock_path onto talloc tosDavid Disseldorp1-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
2015-01-11smbd: Fix a small leak on talloc_tos()Volker Lendecke1-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
2015-01-11smbd: Fix an uninitialized variable readVolker Lendecke1-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>
2014-12-09s3:locking: Change the data model for leases_db to cope with dynamic path ↵Jeremy Allison1-27/+35
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
2014-12-09s3:locking: pass down servicepath to leases_db_add()Jeremy Allison1-0/+2
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-09s3:locking: Add new utility function leases_db_copy_file_ids()Jeremy Allison1-0/+20
Will be used by lease db parsers. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-09s3:locking: pass servicename_new to leases_db_rename()Jeremy Allison1-0/+1
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-05s3: leases: Add leases_db_rename() to cope with renaming a leased file.Jeremy Allison1-0/+22
Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-04s3:locking: add leases_db infrastructureVolker Lendecke1-0/+387
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>