]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-scripts: Get connections after tickle list
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 30 Sep 2024 00:50:00 +0000 (10:50 +1000)
committerMartin Schwenke <martins@samba.org>
Wed, 6 Nov 2024 23:03:42 +0000 (23:03 +0000)
Running ss to get current connections before running ctdb gettickles
means the ss output might be out of date when the 2 lists are
compared.  Some tickles might have been added after ss was run by some
other means (e.g. SMB tickles, added internally) and they would be
deleted according to the stale ss output.

This isn't currently a problem because update_tickles() is currently
only called with port 2049, so all tickles are managed by this code.
That will change in a subsequent commit.

Changing the order means the reverse problem can occur, where
update_tickles() attempts to delete an already deleted tickle.  That
may happen occasionally but is harmless because it doesn't result in
missing information.  It (currently) just causes a message to be
logged at DEBUG level.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jerry Heyman <jheyman@ddn.com>
ctdb/config/functions

index 6fad34797708f3105b1260f377d8ecf4686530b7..8fd20cfdb859d1bbb831fb99756ca16905706b90 100755 (executable)
@@ -1198,6 +1198,14 @@ update_tickles()
        done <"$CTDB_MY_PUBLIC_IPS_CACHE"
        _port_filter="sport == :${_port}"
 
+       # Record our current tickles in a temporary file
+       _my_tickles="${tickledir}/${_port}.tickles.$$"
+       while read -r _i; do
+               $CTDB -X gettickles "$_i" "$_port" |
+                       awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
+       done <"$CTDB_MY_PUBLIC_IPS_CACHE" |
+               sort >"$_my_tickles"
+
        # Record connections to our public IPs in a temporary file.
        # This temporary file is in CTDB's private state directory and
        # $$ is used to avoid a very rare race involving CTDB's script
@@ -1211,14 +1219,6 @@ update_tickles()
                awk '{print $4, $3}' |
                sort >"$_my_connections"
 
-       # Record our current tickles in a temporary file
-       _my_tickles="${tickledir}/${_port}.tickles.$$"
-       while read -r _i; do
-               $CTDB -X gettickles "$_i" "$_port" |
-                       awk -F'|' 'NR > 1 { printf "%s:%s %s:%s\n", $2, $3, $4, $5 }'
-       done <"$CTDB_MY_PUBLIC_IPS_CACHE" |
-               sort >"$_my_tickles"
-
        # Add tickles for connections that we haven't already got tickles for
        comm -23 "$_my_connections" "$_my_tickles" |
                $CTDB addtickle