summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | s3: smbd: Add async internals of reply_ulogoffX.Jeremy Allison2020-04-071-0/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Waits until all aio requests on all fsp's owned by this vuid are finished before returning to the client. Charges the profile time in the done function. Not strictly correct but better than the other SMB1 async code that double-charges profiling in both send and done at the moment. Done this way (commented out) so it is a clean diff and it's clear what is being added. A later commit will remove the old synchronous version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 4dd3012cb1b5e000ccf68d2601dbdbcb7ff538b5)
* | s3: smbd: Remove old synchronous SMB1 reply_tdis().Jeremy Allison2020-04-071-26/+19
| | | | | | | | | | | | | | | | | | | | SMB1 tree disconnect is now fully async. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 7613998e10c5f13c896667257fdef33824a45d2a)
* | s3: smbd: reply_tdis() Update to modern coding standards.Jeremy Allison2020-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | Minimizes the diff in the next commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 71725f1c4adaa04ef04c0dd400c49399952ef5fa)
* | s3: smbd: In reply_tdis(), replace req -> smb1req.Jeremy Allison2020-04-071-6/+6
| | | | | | | | | | | | | | | | | | | | Minimises the diff in the next commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit ca4521f1dd97bc5a05e381c652b05ae1eb8bd29b)
* | s3: smbd: Add async internals of reply_tdis().Jeremy Allison2020-04-071-0/+173
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Waits until all aio requests on all fsp's under this conn struct are finished before returning to the client. Charges the profile time in the done function. Not strictly correct but better than the other SMB1 async code that double-charges profiling in both send and done at the moment. Done this way (commented out) so it is a clean diff and it's clear what is being added. A later commit will remove the old synchronous version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 86cc67d5a7de0a81131b11447dad57b2681d8e01)
* | s3: smbd: Replace synchronous conn_force_tdis() with the async version.Jeremy Allison2020-04-071-28/+16
| | | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 7891302ab8eeba8261b92171a4d429e2f538b89a)
* | s3: smbd: Add async internals of conn_force_tdis().Jeremy Allison2020-04-071-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commented out so it can be seen complete as a diff. The next commit will replace the old synchronous conn_force_tdis() code with the new async code. Uses a wait_queue to cause the force close requests to stay pending until all outstanding aio is finished on all file handles opened on the connection. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 4f9e0459cd06f0332083a4a465f49b5f258838fa)
* | s3: smbd: Don't allow force disconnect of a connection already being ↵Jeremy Allison2020-04-071-0/+5
| | | | | | | | | | | | | | | | | | | | disconnected. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit ac800ca6bcb43c74a1a6ef508b900e2e6cb532dc)
* | s3: smbd: Every place we check fsp->deferred_close, also check for fsp->closing.Jeremy Allison2020-04-072-0/+24
| | | | | | | | | | | | | | | | | | | | | | Eventually this will allow us to remove fsp->deferred_close from the fsp struct (and also source3/lib/tevent_wait.[ch]). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 4287ea138e82103cce0a939e504f9810636b4747)
* | s3: smbd: In async SMB1 reply_close() set fsp->closing = true, as we already ↵Jeremy Allison2020-04-071-0/+7
| | | | | | | | | | | | | | | | | | | | do in SMB2 async close. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit b7d09b30ad14d51bbcbe368a11348754121f6ff8)
* | s3: smbd: Now we free fsp->aio_requests when it gets zero entries, talloc in ↵Jeremy Allison2020-04-071-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | chunks of 10 instead of 1. Prevents incremental +1 tallocs, and the original idea of this array was that it wasn't freed for io efficiency reasons. Add paranoia integer wrap protection also. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit b90bc0f28918133badbf6810d5e298fc326bd1aa)
* | s3: smbd: In aio_del_req_from_fsp() talloc_free(fsp->aio_requests[]) when ↵Jeremy Allison2020-04-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fsp->num_aio_requests reaches zero. The add code in aio_add_req_to_fsp() re-tallocs this array on demand, and talloc freeing it here allows it to be used as the parent for a tevent wait queue, so callers can get notified when all outstanding aio on an fsp is finished. We'll deal with any performance issues in the next commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 0c952bba1edf7c8173d05ccdc6fdaa7232d2c6aa)
* | s3: VFS: vfs_aio_pthread: Make aio opens safe against connection teardown.Jeremy Allison2020-04-071-1/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allocate state off fsp->conn, not NULL, and add a destructor that catches deallocation of conn which happens on connection shutdown or force close. Note - We don't allocate off fsp as the passed in fsp will get freed once we return EINPROGRESS/NT_STATUS_MORE_PROCESSING_REQUIRED. A new fsp pointer gets allocated on every re-run of the open code path. The destructor allows us to NULL out the saved conn struct pointer when conn is deallocated so we know not to access deallocated memory. This matches the async teardown code changes for bug #14301 in pread/pwrite/fsync vfs_default.c and vfs_glusterfs.c state is still correctly deallocated in all code paths so no memory leaks. This allows us to safely complete when the openat() returns and then return the error NT_STATUS_NETWORK_NAME_DELETED to the client open request. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 6b567e0c138d1cf2bcf58c84872ed2b0e89d628d)
* | s3: VFS: vfs_aio_pthread: Add a talloc context parameter to ↵Jeremy Allison2020-04-071-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | create_private_open_data(). Pass in NULL for now so no behavior change. We will be changing this from NULL to fsp->conn in a later commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit e566066605981549b670a5392683fbd81ce93d18)
* | s3: VFS: vfs_aio_pthread. Move xconn into state struct (opd).Jeremy Allison2020-04-071-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | We will need this in future to cause a pending open to be rescheduled after the connection struct we're using has been shut down with an aio open in flight. This will allow a correct error reply to an awaiting client. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit ddb9038fe776b1d8239e563a4c9a70b4097645f3)
* | s3: VFS: vfs_aio_pthread: Replace state destructor with explicitly called ↵Jeremy Allison2020-04-071-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | teardown function. This will allow repurposing a real destructor to allow connections structs to be freed whilst the aio open request is in flight. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit 8db831a318cd4a10ec9c1d629ebff4ca35b8acfe)
* | s3: VFS: vfs_aio_pthread. Fix leak of state struct on error.Jeremy Allison2020-04-071-0/+1
| | | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit a1e247c3ba579ecc6ee03f5aad9679ed79fac5ac)
* | smbd: avoid double chdir() in chdir_current_service()Ralph Boehme2020-04-071-38/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 8e81090789e4cc3ba9e5aa792d4e52971909c894 we're doing chdir() twice, first into conn->connectpath, then into conn->origpath. Before commit 8e81090789e4cc3ba9e5aa792d4e52971909c894 if chdir(conn->connectpath) succeeded, we wouldn't do the second chdir(). While at it, simplify the logging logic: if chdir() fails in this core function, just always log is as error including the unix token. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14256 RN: smbd does a chdir() twice per request Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Feb 6 11:44:07 UTC 2020 on sn-devel-184 (cherry picked from commit f705629a171c1411131164f3adff36175154c093)
* | torture/smb2: Windows 2019 15 ms timestamp resolutionRalph Boehme2020-04-073-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test demonstrates that Windows has a timestamp resolution of ~15ms. When a smaller amount of time than that has passed between modifying operations on a file, it's not necessarily detectable on a Windows 2019 server that implements immediate timestamp updates (no delayed magic). Note that this test relies on a low latency SMB connection. Even with a low latency connection of eg 1m there's a chance of 1/15 that the first part of the test expecting no timestamp change fails as the writetime is updated. Due to this timing dependency this test is skipped in Samba CI, but it is preserved here for future SMB2 timestamps behaviour archealogists. See also: https://lists.samba.org/archive/cifs-protocol/2019-December/003358.html Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 6f7d1d8a37bfb877b3f07423cbcffd15710e8d08)
* | smbd: flush pending writetime update when setting timestamps fileRalph Boehme2020-04-073-8/+22
| | | | | | | | | | | | | | | | | | | | Cf the explanations in the previous commits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 7b90fe69a865ae8648b6548eabbcf2fa8237ebd8)
* | smbd: flush pending writetime update when flushing fileRalph Boehme2020-04-073-1/+14
| | | | | | | | | | | | | | | | | | | | Cf the explanations in the previous commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit d99d5bf2c6d0a818ef2f3920e0c93fac38761c36)
* | smbd: always flush pending write time update when setting filesizeRalph Boehme2020-04-072-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to flush a pending write time update even when we're setting the filesize to current filesize. Note that we're already doing it this way in the relevant places listed my dochelp@MS in https://lists.samba.org/archive/cifs-protocol/2019-December/003364.html Cleanup (= Close) SetBasicInfo SetAllocationInfo SetEndOfFileInfo SetValidDataLengthInfo Flush FSCTL_SET_ENCRYPTION FSCTL_OFFLOAD_WRITE Cleanup (= Close): Already implemented by update_write_time_on_close() and friends. SetBasicInfo: Currently doesn't flush pending updates. Fixed by a subsequent commit. SetAllocationInfo: smb_set_file_allocation_info() when setting a file's allocation size. SetEndOfFileInfo: Currently doesn't flush pending updates. Fixed by a subsequent commit. SetValidDataLengthInfo: Not implemented, returns NT_STATUS_NOT_SUPPORTED which seems wrong btw, as SetValidDataLengthInfo IS listed in MS-SMB2 2.2.39. Flush: Currently doesn't flush pending updates. Fixed by subsequent commit. FSCTL_SET_ENCRYPTION: Windows 2016 doesn't flush a pending writetime update, verified with a smbtorture test. FSCTL_OFFLOAD_WRITE: NT_STATUS_NOT_IMPLEMENTED BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 79d7d6b9d01b8547f16b74a62926d0b471f18c39)
* | torture/smb2: add a test verifying a setinfo(basicinfo) flushes a pending ↵Ralph Boehme2020-04-072-0/+159
| | | | | | | | | | | | | | | | | | | | writetime update BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 4e3c2afbd6f12159252405f6efc6528fa9345f08)
* | torture/smb2: add a test verifying a flush flushes a pending writetime updateRalph Boehme2020-04-072-0/+112
| | | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit c63d6c9e256cdf6a3620373ef0f595e61d43fa97)
* | torture/smb2: mtime update logic with 2 handles: write io on handle 1, then ↵Ralph Boehme2020-04-072-0/+152
| | | | | | | | | | | | | | | | | | | | set mtime on handle 2 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 47508c5ecf0713ef404d5226499a4269651dc020)
* | s4/torture: fix a timestamps test to work on ext filesystemRalph Boehme2020-04-071-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ext filesystem has a time_t limit of 15032385535 (0x0x37fffffff). From Documentation/filesystems/ext4/inodes.rst: If the inode structure size ``sb->s_inode_size`` is larger than 128 bytes and the ``i_inode_extra`` field is large enough to encompass the respective ``i_[cma]time_extra`` field, the ctime, atime, and mtime inode fields are widened to 64 bits. Within this “extra” 32-bit field, the lower two bits are used to extend the 32-bit seconds field to be 34 bit wide; the upper 30 bits are used to provide nanosecond timestamp accuracy. Therefore, timestamps should not overflow until May 2446. ... Changing the test to use the value 0x37fffffff instead of 100000000000 allows running the test locally on ext filesytems. Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 73fedf014bbe02a408360d48e35bce4a6dbc9c36)
* | VERSION: Bump version up to 4.12.2...Karolin Seeger2020-04-071-2/+2
|/ | | | | | and re-enable GIT_SNAPSHOT. Signed-off-by: Karolin Seeger <kseeger@samba.org>
* VERSION: Disable GIT_SNAPSHOT for the 4.12.1 release.samba-4.12.1Karolin Seeger2020-04-071-1/+1
| | | | Signed-off-by: Karolin Seeger <kseeger@samba.org>
* WHATSNEW: Add release notes for Samba 4.12.1.Karolin Seeger2020-04-061-0/+75
| | | | Signed-off-by: Karolin Seeger <kseeger@samba.org>
* s3/utils: Fix double free error with smbtreeNoel Power2020-04-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ==3632== WORKGROUP \\ATP \\ATP\IPC$ IPC Service () ==3632== Invalid read of size 8 ==3632== at 0x773C926: poptResetContext (in /usr/lib64/libpopt.so.0.0.0) ==3632== by 0x773E5DD: poptFreeContext (in /usr/lib64/libpopt.so.0.0.0) ==3632== by 0x10A8BC: main (smbtree.c:354) ==3632== Address 0x16085e00 is 640 bytes inside a block of size 784 free'd ==3632== at 0x4C2F1AD: free (vg_replace_malloc.c:530) ==3632== by 0x773E6F7: poptFreeContext (in /usr/lib64/libpopt.so.0.0.0) ==3632== by 0x10A84B: main (smbtree.c:342) ==3632== Block was alloc'd at ==3632== at 0x4C2FE45: calloc (vg_replace_malloc.c:711) ==3632== by 0x773C79A: poptGetContext (in /usr/lib64/libpopt.so.0.0.0) ==3632== by 0x10A829: main (smbtree.c:339) ==3632== BUG: https://bugzilla.samba.org/show_bug.cgi?id=14332 Signed-off-by: Noel Power <npower@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Wed Apr 1 18:51:43 UTC 2020 on sn-devel-184 (cherry picked from commit 24b03fd28ed19cea8f875f96b3e300f808dfc4ae) Autobuild-User(v4-12-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-12-test): Fri Apr 3 12:24:36 UTC 2020 on sn-devel-184
* nsswitch: fix use-after-free causing segfault in _pam_delete_credGünther Deschner2020-04-011-1/+1
| | | | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14327 Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Mon Mar 30 13:01:20 UTC 2020 on sn-devel-184 (cherry picked from commit 047b0d8ab534c7a10a8572fd9f21e2456fd30710) Autobuild-User(v4-12-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-12-test): Wed Apr 1 08:51:15 UTC 2020 on sn-devel-184
* ctdb-recoverd: Avoid dereferencing NULL rec->nodemapMartin Schwenke2020-03-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inside the nested event loop in ctdb_ctrl_getnodemap(), various asynchronous handlers may dereference rec->nodemap, which will be NULL. One example is lost_reclock_handler(), which causes rec->nodemap to be unconditionally dereferenced in list_of_nodes() via this call chain: list_of_nodes() list_of_active_nodes() set_recovery_mode() force_election() lost_reclock_handler() Instead of attempting to trace all of the cases, just avoid leaving rec->nodemap set to NULL. Attempting to use an old value is generally harmless, especially since it will be the same as the new value in most cases. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14324 Reported-by: Volker Lendecke <vl@samba.org> 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): Tue Mar 24 01:22:45 UTC 2020 on sn-devel-184 (cherry picked from commit 716f52f68b248ae7cfd66479b3fc678c4a0d8b38) Autobuild-User(v4-12-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-12-test): Mon Mar 30 09:36:01 UTC 2020 on sn-devel-184
* ctdb-daemon: Don't allow attach from recovery if recovery is not activeMartin Schwenke2020-03-301-0/+7
| | | | | | | | | | | Neither the recovery daemon nor the recovery helper should attach databases outside of the recovery process. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 147afe77de372ddb9c180228d6fe1b04cca4610f)
* ctdb-daemon: Remove more unused old client database functionsMartin Schwenke2020-03-302-117/+0
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 052f1bdb9cf78f53f584edd32f81ae8e01e8e86e)
* ctdb-recovery: Remove old code for creating missing databasesMartin Schwenke2020-03-301-161/+0
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 3a66d181b6f6199fca362fcb0aa06513645b589d)
* ctdb-recovery: Create database on nodes where it is missingMartin Schwenke2020-03-301-1/+177
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 76a8174279f42486b36cc41d5831d4e6613f172e)
* ctdb-recovery: Fetch database name from all nodes where it is attachedMartin Schwenke2020-03-301-13/+67
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit e6e63f8fb8194634135bf34cda18f6cc8ff69a7c)
* ctdb-recovery: Pass db structure for each database recoveryMartin Schwenke2020-03-301-31/+28
| | | | | | | | | | Instead of db_id and db_flags. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 1bdfeb3fdc06947a607957ab3d114f97bad5d7d7)
* ctdb-recovery: GET_DBMAP from all nodesMartin Schwenke2020-03-301-23/+54
| | | | | | | | | | | This builds a complete list of databases across the cluster so it can be used to create databases on the nodes where they are missing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit c6f74e590f602e2ed38fe293468770a5e669aefa)
* ctdb-recovery: Replace use of ctdb_dbid_map with local db_listMartin Schwenke2020-03-301-15/+161
| | | | | | | | | | | | | | | | This will be used to build a merged list of databases from all nodes, allowing the recovery helper to create missing databases. It would be possible to also include the db_name field in this structure but that would cause a lot of churn. This field is used locally in the recovery of each database so can continue to live in the relevant state structure(s). BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 4c0b9c36050a0ed8a180d4ac1853224089528e8e)
* ctdb-daemon: Respect CTDB_CTRL_FLAG_ATTACH_RECOVERY when attaching databasesMartin Schwenke2020-03-301-1/+1
| | | | | | | | | | | | | This is currently only set by the recovery daemon when it attaches missing databases, so there is no obvious behaviour change. However, attaching missing databases can now be moved to the recovery helper as long as it sets this flag. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 7e5a8a4884ea87bb985fe0e2b65ff130fc2ba8aa)
* ctdb-recovery: Use CTDB_CTRL_FLAG_ATTACH_RECOVERY to attach during recoveryMartin Schwenke2020-03-301-2/+11
| | | | | | | | | | | | | | | | | ctdb_ctrl_createdb() is only called by the recovery daemon, so this is a safe, temporary change. This is temporary because ctdb_ctrl_createdb(), create_missing_remote_databases() and create_missing_local_databases() will all go away soon. Note that this doesn't cause a change in behaviour. The main daemon will still only defer attaches from non-recoverd processes during recovery. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 98e3d0db2bc5f33217e26fab1dfb4bb91eae534f)
* ctdb-protocol: Add control flag CTDB_CTRL_FLAG_ATTACH_RECOVERYMartin Schwenke2020-03-301-0/+1
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 17ed0425904a98624284d351ab7617b3e02c0f7b)
* ctdb-daemon: Remove unused old client database functionsMartin Schwenke2020-03-303-168/+2
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit fc23cd1b9cdd1d70067491614b16e616291e8ff2)
* ctdb-daemon: Fix database attach deferral logicMartin Schwenke2020-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Commit 3cc230b5eeca749ab68d19cfda969f72c269f1f6 says: Dont allow clients to connect to databases untile we are well past and through the initial recovery phase It is unclear what this commit was attempting to do. The commit message implies that more attaches should be deferred but the code change adds a conjunction that causes less attaches to be deferred. In particular, no attaches will be deferred after startup is complete. This seems wrong. To implement what seems to be stated in the commit message an "or" needs to be used so that non-recovery daemon attaches are deferred either when in recovery or before startup is complete. Making this change highlights that attaches need to be allowed during the "startup" event because this is when smbd is started. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit c6c89495fbe9b6f238d10a538eccc92b937a69de)
* ctdb-recovery: Refactor banning a node into separate computationAmitay Isaacs2020-03-301-53/+208
| | | | | | | | | | | If a node is marked for banning, confirm that it's not become inactive during the recovery. If yes, then don't ban the node. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 1c56d6413f86cc15ebac232f39ef1e2a53ae4297)
* ctdb-recovery: Don't trust nodemap obtained from local nodeAmitay Isaacs2020-03-301-3/+113
| | | | | | | | | | | | | It's possible to have a node stopped, but recovery master not yet updated flags on the local ctdb daemon when recovery is started. So do not trust the list of active nodes obtained from the local node. Query the connected nodes to calculate the list of active nodes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit c6a0ff1bed0265e44fd6135d16bfc41919fe5bf5)
* ctdb-recovery: Consolidate node stateAmitay Isaacs2020-03-301-239/+346
| | | | | | | | | | This avoids passing multiple arguments to async computation. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 6e2f8756f1bce4dfc7fdc435e082f400116e29ec)
* ctdb-recovery: Fetched vnnmap is never used, so don't fetch itAmitay Isaacs2020-03-301-40/+0
| | | | | | | | | | | New vnnmap is constructed using the information from all the connected nodes. So there is no need to fetch the vnnmap from recovery master. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14294 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 072ff4d12b8f34766120ddae888d772e97bca491)
* selftest: test samba-tool group commands with groupnames with brackets and ↵Björn Baumbach2020-03-271-1/+4
| | | | | | | | | | | | | spaces BUG: https://bugzilla.samba.org/show_bug.cgi?id=14296 Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Andrew Bartlett <abartlet@samba.org> (cherry picked from commit 534809a0f09775390e89fa1cbfae3a1d0fafecb8) Autobuild-User(v4-12-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-12-test): Fri Mar 27 13:19:20 UTC 2020 on sn-devel-184