summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Skip some tests that don't work with IPv6Martin Schwenke2020-01-142-0/+24
| | | | | | | | | | | | | | | | | | | | | | | See the comments added to the tests. It may be possible to rewrite these so they do something sane for IPv6... some other time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227 RN: Fix IPv6 issues (NFS connection tracking, tests) 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): Fri Jan 3 00:00:55 UTC 2020 on sn-devel-184 (backported from commit 9edf15afc219a1a782ec1e4d29909361bbabc744) Signed-off-by: Martin Schwenke <martin@meltin.net> Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Tue Jan 14 10:28:01 UTC 2020 on sn-devel-184
* ctdb-scripts: Strip square brackets when gathering connection infoMartin Schwenke2020-01-141-0/+6
| | | | | | | | | | | | | | | | | | | ss added square brackets around IPv6 addresses in versions > 4.12.0 via commit aba9c23a6e1cb134840c998df14888dca469a485. CentOS 7 added this feature somewhere mid-release. So, backward compatibility is obviously needed. As per the comment protocol/protocol_util.c should probably print and parse such square brackets. However, for backward compatibility the brackets would have to be stripped in both places in update_tickles()... or added to the ss output when missing. Best to leave this until we have a connection tracking daemon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 693080abe4d8bec96280af5a6aa668251a98ec5d)
* ctdb-tcp: Close inflight connecting TCP sockets after forkVolker Lendecke2019-11-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets while sitting in the async connect() syscall are not freed via ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure. Free this structure as well. If an outgoing TCP socket leaks into a long-running child process (possibly the recovery daemon), this connection will never be closed as seen by the destination node. Because with recent changes incoming connections will not be accepted as long as any incoming connection is alive, with that socket leak into the recovery daemon we will never again be able to successfully connect to the node that is affected by this leak. Further attempts to connect will be discarded by the destination as long as the recovery daemon keeps this socket alive. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 RN: Avoid communication breakdown on node reconnect Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit a6d99d9e5c5bc58e6d56be7a6c1dbc7c8d1a882f) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Tue Nov 19 13:21:18 UTC 2019 on sn-devel-184
* ctdb-tcp: Drop tracking of file descriptor for incoming connectionsMartin Schwenke2019-11-194-11/+0
| | | | | | | | | | | This file descriptor is owned by the incoming queue. It will be closed when the queue is torn down. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bf47bc18bb8a94231870ef821c0352b7a15c2e28)
* ctdb-tcp: Avoid orphaning the TCP incoming queueMartin Schwenke2019-11-191-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTDB's incoming queue handling does not check whether an existing queue exists, so can overwrite the pointer to the queue. This used to be harmless until commit c68b6f96f26664459187ab2fbd56767fb31767e0 changed the read callback to use a parent structure as the callback data. Instead of cleaning up an orphaned queue on disconnect, as before, this will now free the new queue. At first glance it doesn't seem possible that 2 incoming connections from the same node could be processed before the intervening disconnect. However, the incoming connections and disconnect occur on different file descriptors. The queue can become orphaned on node A when the following sequence occurs: 1. Node A comes up 2. Node A accepts an incoming connection from node B 3. Node B processes a timeout before noticing that outgoing the queue is writable 4. Node B tears down the outgoing connection to node A 5. Node B initiates a new connection to node A 6. Node A accepts an incoming connection from node B Node A processes then the disconnect of the old incoming connection from (2) but tears down the new incoming connection from (6). This then occurs until the originally affected node is restarted. However, due to the number of outgoing connection attempts and associated teardowns, this induces the same behaviour on the corresponding incoming queue on all nodes that node A attempts to connect to. Therefore, other nodes become affected and need to be restarted too. As a result, the whole cluster probably needs to be restarted to recover from this situation. The problem can occur any time CTDB is started on a node. The fix is to avoid accepting new incoming connections when a queue for incoming connections is already present. The connecting node will simply retry establishing its outgoing connection. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit d0baad257e511280ff3e5c7372c38c43df841070)
* ctdb-tcp: Check incoming queue to see if incoming connection is upMartin Schwenke2019-11-191-1/+1
| | | | | | | | | | | This makes it consistent with the reverse case. Also, in_fd will soon be removed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit e62b3a05a874db13a848573d2e2fb1c157393b9c)
* ctdb-vacuum: Process all records not deleted on a remote nodeAmitay Isaacs2019-10-161-1/+1
| | | | | | | | | | | This currently skips the last record. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14147 RN: Avoid potential data loss during recovery after vacuuming error Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 33f1c9d9654fbdcb99c23f9d23c4bbe2cc596b98)
* ctdb-tools: Stop deleted nodes from influencing ctdb nodestatus exit codeMartin Schwenke2019-09-201-1/+7
| | | | | | | | | | | Deleted nodes should simply be ignored. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14129 RN: Stop deleted nodes from influencing ctdb nodestatus exit code Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 32b5ceb31936ec5447362236c1809db003561d29)
* ctdb: fix compilation on systems with glibc robust mutexesRalph Boehme2019-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On older systems like SLES 11 without POSIX robust mutexes, but with glib robust mutexes where all the functions are available but have a "_np" suffix, compilation fails in: ctdb/tests/src/test_mutex_raw.c.239.o: In function `worker': /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:129: undefined reference to `pthread_mutex_consistent' ctdb/tests/src/test_mutex_raw.c.239.o: In function `main': /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:285: undefined reference to `pthread_mutex_consistent' /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:332: undefined reference to `pthread_mutexattr_setrobust' /root/samba-4.10.6/bin/default/../../ctdb/tests/src/test_mutex_raw.c:363: undefined reference to `pthread_mutex_consistent' collect2: ld returned 1 exit status This could be fixed by using libreplace system/threads.h instead of pthreads.h directly, but as there has been a desire to keep test_mutex_raw.c standalone and compilable without other external depenencies then libc and libpthread, make the tool developer build only. This should get the average user over the cliff. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14038 RN: Fix compiling ctdb on older systems lacking POSIX robust mutexes Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit f5388f97792ac2d7962950dad91aaf8ad49bceaa) Autobuild-User(v4-11-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-11-test): Fri Sep 6 08:19:44 UTC 2019 on sn-devel-184
* ctdb-recoverd: Fix typo in previous fixMartin Schwenke2019-09-041-1/+1
| | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 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 27 15:29:11 UTC 2019 on sn-devel-184 (cherry picked from commit 8190993d99284162bd8699780248bb2edfec2673)
* ctdb-tests: Clear deleted record via recovery instead of vacuumingMartin Schwenke2019-09-041-12/+5
| | | | | | | | | | | | | | | | | | | This test has been flapping because sometimes the record is not vacuumed within the expected time period, perhaps even because the check for the record can interfere with vacuuming. However, instead of waiting for vacuuming the record can be cleared by doing a recovery. This should be much more reliable. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 RN: Fix flapping CTDB tests 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): Wed Aug 21 13:06:57 UTC 2019 on sn-devel-184 (cherry picked from commit 71ad473ba805abe23bbe6c1a1290612e448e73f3)
* ctdb-tests: Strengthen volatile DB traverse testMartin Schwenke2019-09-041-15/+52
| | | | | | | | | | | Check the record count more often, from multiple nodes. Add a case with multiple records. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit ca4df06080709adf0cbebc95b0a70b4090dad5ba)
* ctdb-recoverd: Only check for LMASTER nodes in the VNN mapMartin Schwenke2019-09-041-4/+10
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 5d655ac6f2ff82f8f1c89b06870d600a1a3c7a8a)
* ctdb-tests: Don't retrieve the VNN map from target node for notlmasterMartin Schwenke2019-09-041-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use the VNN map from the node running node_has_status(). This means that wait_until_node_has_status 1 notlmaster 10 0 will run "ctdb status" on node 0 and check (for up to 10 seconds) if node 1 is in the VNN map. If the LMASTER capability has been dropped on node 1 then the above will wait for the VNN map to be updated on node 0. This will happen as part of the recovery that is triggered by the change of LMASTER capability. The next command will then only be able to attach to $TESTDB after the recovery is complete thus guaranteeing a sane state for the test to continue. This stops simple/79_volatile_db_traverse.sh from going into recovery during the traverse or at some other inconvenient time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 53daeb2f878af1634a26e05cb86d87e2faf20173)
* ctdb-tests: Handle special cases first and returnMartin Schwenke2019-09-041-31/+28
| | | | | | | | | | All the other cases involve matching bits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bff1a3a548a2cace997b767d78bb824438664cb7)
* ctdb-tests: Inline handling of recovered and notlmaster statusesMartin Schwenke2019-09-041-6/+12
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit bb59073515ee5f7886b5d9a20d7b2805857c2708)
* ctdb-tests: Drop unused node statuses frozen/unfrozenMartin Schwenke2019-09-041-6/+2
| | | | | | | | | | Silently drop unused local variable mpat. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 9b09a87326af28877301ad27bcec5bb13744e2b6)
* ctdb-tests: Reformat node_has_status()Martin Schwenke2019-09-041-46/+48
| | | | | | | | | | Re-indent and drop non-POSIX left-parenthesis from case labels. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 52227d19735a3305ad633672c70385f443f222f0)
* ctdb-daemon: Make node inactive in the NODE_STOP controlMartin Schwenke2019-08-281-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 (cherry picked from commit e9f2e205ee89f4f3d6302cc11b4d0eb2efaf0f53)
* ctdb-daemon: Drop unused function ctdb_local_node_got_banned()Martin Schwenke2019-08-282-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> (cherry picked from commit 91ac4c13d8472955d1f04bd775ec4b3ff8bf1b61)
* ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()Martin Schwenke2019-08-281-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> (cherry picked from commit 0f5f7b7cf4e970f3f36c5e0b3d09e710fe90801a)
* ctdb-daemon: Factor out new function ctdb_node_become_inactive()Martin Schwenke2019-08-282-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> (cherry picked from commit a42bcaabb63722411bee52b80cbfc795593defbc)
* ctdb-tcp: Mark node as disconnected if incoming connection goes awayMartin Schwenke2019-08-282-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 (cherry picked from commit 73c850eda4209b688a169aeeb20c453b738cbb35)
* ctdb-tcp: Only mark a node connected if both directions are upMartin Schwenke2019-08-281-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> (cherry picked from commit 8c98c10f242bc722beffc711e85c0e4f2e74cd57)
* ctdb-tcp: Create outbound queue when the connection becomes writableMartin Schwenke2019-08-283-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> (cherry picked from commit 7f4854d9643a096a6d8a354fcd27b7c6ed24a75e)
* ctdb-tcp: Use TALLOC_FREE()Martin Schwenke2019-08-281-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> (cherry picked from commit d80d9edb4dc107b15a35a39e5c966a3eaed6453a)
* ctdb-tcp: Move incoming fd and queue into struct ctdb_tcp_nodeMartin Schwenke2019-08-284-34/+61
| | | | | | | | | | | This makes it easy to track both incoming and outgoing connectivity states. 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> (cherry picked from commit c68b6f96f26664459187ab2fbd56767fb31767e0)
* ctdb-tcp: Rename fd -> out_fdMartin Schwenke2019-08-283-49/+72
| | | | | | | | | | | | | | in_fd is coming soon. Fix coding style violations in the affected and adjacent lines. Modernise some debug macros and make them more consistent (e.g. drop logging of errno when strerror(errno) is already logged. 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> (cherry picked from commit c06620169fc178ea6db2631f03edf008285d8cf2)
* ctdb-daemon: Add function ctdb_ip_to_node()Martin Schwenke2019-08-282-5/+21
| | | | | | | | | | | | | | | This is the core logic from ctdb_ip_to_pnn(), so re-implement that that function using ctdb_ip_to_node(). Something similar (ctdb_ip_to_nodeid()) was recently removed in commit 010c1d77cd7e192b1fff39b7b91fccbdbbf4a786 because it wasn't required. Now there is a use case. 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> (cherry picked from commit 3acb8e9d1c854b577d6be282257269df83055d31)
* ctdb-tools: Drop 'o' option from getopts commandMartin Schwenke2019-08-261-1/+1
| | | | | | | | | | | | | Commit 90de5e0594b9180226b9a13293afe31f18576b3d remove the processing for this option but forgot to remove it from the getopts command. Versions of ShellCheck >= 0.4.7 warn on this, so it is worth fixing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14086 RN: Fix onnode test failure with ShellCheck >= 0.4.7 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 758962a0d435fa595e3917b860a8fd266d122550)
* ctdb-tools: CID 1449530 - Negative loop boundMartin Schwenke2019-07-051-4/+6
| | | | | | | | | | | Regression introduced by commit 2558f96da1f9be8034f26736c8050bb38a1f82a8. count should be signed because list_of_connected_nodes() returns -1 on failure. Variable i is used in both signed and unsigned contexts, so add new signed variable j for use in signed context. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-config: depend on /etc/ctdb/nodes fileRafael David Tinoco2019-07-051-0/+1
| | | | | | | | | | | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14017 CTDB should start as a disabled unit (systemd) in most of the distributions and, when trying to enable it for the first time, user should get an unconfigured, or similar, error. Depending on /etc/ctdb/nodes file will give a clear direction to final user on what is needed in order to get cluster up and running. It should work like previous ENABLED=NO variables in SySV like initialization scripts. Signed-off-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rename local-daemon.sh dump-logs to print-logMartin Schwenke2019-07-051-4/+4
| | | | | | | | | | This makes it consistent with print-socket. 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): Fri Jul 5 06:19:11 UTC 2019 on sn-devel-184
* ctdb-build: Tweak hacking of rpcgen outputMartin Schwenke2019-07-051-1/+1
| | | | | | | | | csbuild doesn't like the hack where variable buf is initialised to itself to avoid an unused variable warning. buf is unused so remove it instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Don't check if lock_ctx->ctdb_db is NULLMartin Schwenke2019-07-051-33/+16
| | | | | | | | | | | This can never be NULL. It could probably be NULL in the past when "all database" locks existed. There are paths where is is checked for NULL and then later dereferenced, causing static analysers to produce spurious warnings. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Mark ctdb_fatal() and ctdb_die() as _NORETURN_Martin Schwenke2019-07-051-2/+4
| | | | | | | | This avoids static analysers continuing analysis after calls to these functions and producing incorrect warnings. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-event: Fix signed/unsigned comparisons by castingMartin Schwenke2019-07-052-2/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-database: Fix signed/unsigned comparison by castingMartin Schwenke2019-07-051-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-event: Assign missing return valueMartin Schwenke2019-07-051-0/+1
| | | | | | | | Otherwise ret == 0 is returned from successful call to ctdb_int32_pull(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Fix signed/unsigned comparisons by declaring as unsignedMartin Schwenke2019-07-052-5/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Fix error handlingMartin Schwenke2019-07-051-4/+14
| | | | | | | | | | | | | According to the documentation, sendto() should either send the packet as given or return with an error. However, given that it can return the number of bytes sent, treat the theoretical error of a short packet send separately, since errno would not be set in this case. Similarly, treat a short packet recv() separately from an error where errno is set. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Fix signed/unsigned comparisons by castingMartin Schwenke2019-07-053-4/+7
| | | | | | | One case needs an extra variable declared. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Drop unused function ctdb_vfork_with_logging()Martin Schwenke2019-07-052-106/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Avoid signed/unsigned comparison by castingMartin Schwenke2019-07-052-10/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Variable for return value of strlcpy() should be size_tMartin Schwenke2019-07-051-1/+1
| | | | | | | This avoids an unnecessary signed/unsigned comparison issue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Fix signed/unsigned comparison by declaring as unsignedMartin Schwenke2019-07-051-1/+2
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-protocol: Do not ignore return value of ctdb_g_lock_pull()Martin Schwenke2019-07-051-1/+1
| | | | | | | | | | | clang reports: ctdb/protocol/protocol_types.c:5191:3: warning: Value stored to 'ret' is never read Found by csbuild. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Don't index by PNN when initialising node flagsMartin Schwenke2019-07-051-9/+12
| | | | | | | | | | Indexing by PNN is wrong. This also removes a signed/unsigned comparison because the PNN is not compared to -1 anymore. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Replace function ctdb_ip_to_nodeid() with ctdb_ip_to_pnn()Martin Schwenke2019-07-054-20/+18
| | | | | | | | | | | Node ID is a poorly defined concept, indicating the slot in the node map where the IP address was found. This signed value also ends up compared to num_nodes, which is unsigned, producing unwanted warnings. Just return the PNN because this what both callers really want. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Fix signed/unsigned comparisons by declaring as unsignedMartin Schwenke2019-07-052-3/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>