summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* tdb: Release tdb 1.4.2tdb-1.4.2Stefan Metzmacher2019-08-202-1/+74
| | | | | | | | | | | * Build fixes * Improve the performance by inlining the tdb_oob() checks 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): Tue Aug 20 14:45:41 UTC 2019 on sn-devel-184
* ctdb-daemon: Make node inactive in the NODE_STOP controlMartin Schwenke2019-08-201-0/+2
| | | | | | | | | | | | | | | | | | | Currently some of this is supported by a periodic check in the recovery daemon's main_loop(), which notices the flag change, sets recovery mode active and freezes databases. If STOP_NODE returns immediately then the associated recovery can complete and the node can be continued before databases are actually frozen. Instead, immediately do all of the things that make a node inactive. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087 RN: Stop "ctdb stop" from completing before freezing databases Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Tue Aug 20 08:32:27 UTC 2019 on sn-devel-184
* ctdb-daemon: Drop unused function ctdb_local_node_got_banned()Martin Schwenke2019-08-202-25/+0
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()Martin Schwenke2019-08-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | There's no reason to avoid immediately setting recovery mode to active and initiating freeze of databases. This effectively reverts the following commits: d8f3b490bbb691c9916eed0df5b980c1aef23c85 b4357a79d916b1f8ade8fa78563fbef0ce670aa9 The latter is now implemented using a control, resulting in looser coupling. See also the following commit: f8141e91a693912ea1107a49320e83702a80757a BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Factor out new function ctdb_node_become_inactive()Martin Schwenke2019-08-202-0/+45
| | | | | | | | | | This is a superset of ctdb_local_node_got_banned() so will replace that function, and will also be used in the NODE_STOP control. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* build: fix mandatory typo in zlib configure checkDavid Disseldorp2019-08-201-1/+1
| | | | | | | | | | | | | This ensures that waf correctly fails during configure if zlib is missing. msg can also be dropped as it matches the waf validate_cfg() default (ignoring the quotes). Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Aug 20 06:58:12 UTC 2019 on sn-devel-184
* ldb: Free memory when repacking databaseTim Beale2019-08-201-0/+1
| | | | | | | | | | | | | | | | | The msg for each database record is allocated on the module context, but never freed. The module seems like it could be a long-running context (as the database would normally get repacked by the samba executable). Even if it's not a proper leak, it shouldn't hurt to cleanup the memory. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Garming Sam <garming@samba.org> Autobuild-Date(master): Tue Aug 20 04:57:10 UTC 2019 on sn-devel-184
* ldb: Log the partition we're repackingTim Beale2019-08-201-2/+4
| | | | | | | | | | | | | | | | | | | | | | | Firstly, with Samba AD this looks a little weird because we log the same message 5 times (once for every partition). If we log that we're doing this to records in different partitions, hopefully someone with a little Samba knowledge can figure out what's going on. Secondly, the info about what partitions are actually changing might be useful. E.g. if we hit a fatal error repacking the 3rd partition, and the transaction doesn't abort properly, then it would be useful to know what partitions were repacked and which ones weren't. There doesn't appear to be a useful name for the partition (ldb_kv->kv_ops->name() doesn't seem any more intelligible to a user), so just log the first record that we update. We can use that to infer the partition database). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Log pack format in user-friendly wayTim Beale2019-08-201-2/+15
| | | | | | | | | | | | The "format 0x26011968" log confused me (and I'm a developer). We can subtract the base offset from the pack format to get a more user-friendly number, e.g. v0 (not actually used), v1, v2, etc. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Change pack format defines to enumTim Beale2019-08-201-5/+8
| | | | | | | | | | | The main reason is so that any future pack formats will continue incrementing this number in a sequential fashion. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Move where we update the pack format versionTim Beale2019-08-203-2/+4
| | | | | | | | | | | | | | | | Store it on the repack context so that we can log a more informative message "Repacking from format x to format y". While this is not really a big deal currently, it could be worth recording for potential future scenarios (i.e. supporting three or more pack versions), where upgrades could potentially skip an intermediary pack format version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ldb: Always log when the database pack format changesTim Beale2019-08-202-1/+4
| | | | | | | | | | | | | | | LDB_DEBUG_WARNING gets logged by Samba as level 2, whereas the default log level for Samba is 0. It's not really fair to the user to change the format of their database on disk and potentially not tell them. This patch adds a log with level zero (using a alias define, as this technically isn't a fatal problem). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* downgradedatabase: installing scriptAaron Haslett2019-08-204-3/+5
| | | | | | | | | | | | | | Installing downgrade script so people don't need the source tree for it. Exception added in usage test because running the script without arguments is valid. (This avoids the need to knownfail it). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* downgradedatabase: Add man-page documentationAaron Haslett2019-08-202-0/+96
| | | | | | | | | | | | A man-page is needed so that we can install this tool as part of the Samba package. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* downgradedatabase: rename to samba_downgrade_dbTim Beale2019-08-203-2/+2
| | | | | | | | | | Just so that it's slightly less of a mouthful for users. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* tests: Avoid hardcoding relative filepathTim Beale2019-08-201-2/+2
| | | | | | | | | | If we move the test file, the test will break. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* downgradedatabase: comply with samba.tests.sourceAaron Haslett2019-08-201-3/+23
| | | | | | | | | | | | In next commit we'll install the script, samba.tests.source picked up the lack of a copyright message and some whitespace errors, so this patch fixes that stuff first. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* smbd: Move lease type detection in delay_for_oplock()Volker Lendecke2019-08-201-24/+24
| | | | | | | | | | Walk the share_modes array only once. 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 Aug 20 00:33:12 UTC 2019 on sn-devel-184
* smbd: Merge grant_fsp_oplock_type() into delay_for_oplock()Volker Lendecke2019-08-191-26/+14
| | | | | | | | This is a preparation for the next commit: Only walk the share_modes[] array once when handling oplocks and leases. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Move delay_for_oplock() downVolker Lendecke2019-08-191-116/+116
| | | | | | | | | | We'll merge grant_fsp_oplock_type() into this function. This makes the next commit smaller, and the newly extended delay_for_oplocks will for example reference static file_has_brlocks() above. Make forward declarations unnecessary. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Make delay_for_oplock() return NTSTATUSVolker Lendecke2019-08-191-13/+15
| | | | | | | | A further commit will merge grant_fsp_oplock_type (returning NTSTATUS) into delay_for_oplock(). Make that commit smaller. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Slightly simplify grant_fsp_oplock_type()Volker Lendecke2019-08-191-7/+0
| | | | | | | This is never called with INTERNAL_OPENs anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Slightly simplify delay_for_oplock()Volker Lendecke2019-08-191-2/+1
| | | | | | | | This is never called for INTERNAL_OPENs anymore, see handle_share_mode_lease() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Introduce handle_share_mode_lease()Volker Lendecke2019-08-191-38/+71
| | | | | | | | This consolidates the core share_mode_lock access of open_file_ntcreate into one routine. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Move set_share_mode() out of grant_fsp_oplock_type()Volker Lendecke2019-08-191-33/+27
| | | | | | | | | | This shows that "req", "share_access" and "access_mask" are not needed for the core logic of grant_fsp_oplock_type() and it separates concerns a bit: open_directory() also does the set_share_mode() in the main open routine, not in a helper like grant_fsp_oplock_type() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Move grant_fsp_oplock_type() close to delay_for_oplock()Volker Lendecke2019-08-191-18/+21
| | | | | | | | | | Note that this is not a cut&paste: Instead of fsp->access_mask we use the access_mask the client requested. At the new code location fsp->access_mask (a.k.a. open_access_mask) might have FILE_WRITE_DATA from O_TRUNC (a.k.a. FILE_OVERWRITE). Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Slightly simplify open_file_ntcreate()Volker Lendecke2019-08-191-12/+0
| | | | | | | There is no reference to "file_existed" after this point anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Remove a late ref to "file_existed" in open_file_ntcreate()Volker Lendecke2019-08-191-2/+2
| | | | | | | | | If you follow "existing_dos_attributes" through the routine, this can only ever be !=0 if SMB_VFS_GET_DOS_ATTRIBUTES() was successful. This can only have been successful if the file existed. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Move resetting "oplock_request" to before delay_for_oplock()Volker Lendecke2019-08-191-17/+17
| | | | | | | | | | It seems to make little sense to me to do the oplock break with one setting and then later on grant_fsp_oplock_type with another one. Survives tests, I can't think of any scenario where this (to me) simplification would break anything Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: For kernel-oplocked files don't call delay_for_oplock()Volker Lendecke2019-08-191-39/+24
| | | | | | | | | | | | The kernel has already sent the signal. We don't have to send another message. Instead, just directly wait for the downgrade to happen via the watch on the share mode lock assuming it's there. Also setup the polling interval: I could imagine that in some race situation the file has already been closed and re-opened by a nonsamba process while we were waiting. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Optionally wait for a share mode record in setup_poll_open()Volker Lendecke2019-08-191-0/+39
| | | | | | | | This will be used when waiting for a oplock break that has been signalled via a kernel oplock break. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Simplify has_other_nonposix_opens()Volker Lendecke2019-08-193-10/+6
| | | | | | | | | We pick quite some information from "fsp" already, so from an API design perspecitve it's only fair to only use its implicit server_id. This is what all the callers did anyway. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Align integer typesVolker Lendecke2019-08-191-1/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Simplify delay_for_oplock()Volker Lendecke2019-08-191-5/+1
| | | | | | | Use is_same_lease() Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Move is_same_lease() up in the fileVolker Lendecke2019-08-191-17/+17
| | | | | | | The next commit will need it there Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Simplify is_same_lease()Volker Lendecke2019-08-191-2/+1
| | | | | | | It does not use "struct share_mode_data" Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Optimize delay_for_oplock()Volker Lendecke2019-08-191-6/+6
| | | | | | | | get_lease_type() can involve a database access. Do that only if necessary, and that is at most once in this loop. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* lib: Remove a duplicate function prototypeVolker Lendecke2019-08-191-5/+0
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Remove a misleading commentVolker Lendecke2019-08-191-1/+0
| | | | | | | open_mode_check() is done before the oplock breaks. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Merge two DEBUGs into oneVolker Lendecke2019-08-191-6/+6
| | | | | | | This looks easier to understand to me, less lines in logfiles Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Avoid casts in share_conflict()Volker Lendecke2019-08-191-14/+14
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* smbd: Save two lines in find_share_mode_entryVolker Lendecke2019-08-191-3/+1
| | | | | | | Directly initialized variables give compilers less reason to complain Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* lib: Micro-optimization for db_tdb_do_locked()Volker Lendecke2019-08-191-2/+2
| | | | | | | We don't need the tdb lock for the talloc_free(buf) anymore Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* third_party: Remove historical tombstone about zlib diverganceAndrew Bartlett2019-08-171-1033/+0
| | | | | | | | | | Now this has been recorded in the git history, we can remove it. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Sat Aug 17 05:10:48 UTC 2019 on sn-devel-184
* third_party: Remove zlib from third_partyAndrew Bartlett2019-08-17201-54091/+1038
| | | | | | | | | | | | | | | | | | | | | | | | | We require zlib 1.2.3. We stopped requring a patched zlib with 5631a1b9bc03d6cf31af66b13872255f18979fe8 As discussed on samba-technical here: https://lists.samba.org/archive/samba-technical/2019-May/133476.html In short, zlib contains some (old, now broken) crypto code that while not compiled in Samba is best left out of our tarball to ease crypto audits. It is also very very out of date and is a slightly modified copy of something otherwise very likely available on our supported host OSs. It would be strange to say that GnuTLS and dependencies are an acceptable burden to install but say zlib is a step to far. So it is removed from Samba's third_party with this commit. The diff between zlib in Samba and official zlib 1.2.3 is included in third_party/zlib/last-samba-from-1.2.3.diff Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* Prevent samba-tool online backup crashDavid Mulder2019-08-172-5/+33
| | | | | | | | | | | | On some GPOs, getting a files ntacl throws an NT_STATUS_ACCESS_DENIED. Catch and log the failure when this happens. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14088 Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Tim Beale <timbeale@samba.org>
* ctdb-tcp: Mark node as disconnected if incoming connection goes awayMartin Schwenke2019-08-162-2/+5
| | | | | | | | | | | | | | To make it easy to pass the node data to the upcall, the private data for ctdb_tcp_read_cb() needs to be changed from tnode to node. RN: Avoid marking a node as connected before it can receive packets BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Fri Aug 16 22:50:35 UTC 2019 on sn-devel-184
* ctdb-tcp: Only mark a node connected if both directions are upMartin Schwenke2019-08-161-3/+17
| | | | | | | | | | | | | Nodes are currently marked as up if the outgoing connection is established. However, if the incoming connection is not yet established then this node could send a request where the replying node can not queue its reply. Wait until both directions are up before marking a node as connected. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Create outbound queue when the connection becomes writableMartin Schwenke2019-08-163-12/+25
| | | | | | | | | | | | | | | | Since commit ddd97553f0a8bfaada178ec4a7460d76fa21f079 ctdb_queue_send() doesn't queue a packet if the connection isn't yet established (i.e. when fd == -1). So, don't bother creating the outbound queue during initialisation but create it when the connection becomes writable. Now the presence of the queue indicates that the outbound connection is up. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Use TALLOC_FREE()Martin Schwenke2019-08-161-4/+2
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>