Revision ad85cd50b5216ef3ddc3a7347787d10fe5ab2a0d authored by Marco Iorio on 19 June 2024, 07:41:22 UTC, committed by Julian Wiedmann on 20 June 2024, 05:43:35 UTC
In order to prevent possible race conditions when watching clustermesh
config file changes, once we receive a file change notification, we
first add that path to the list of watched ones and, if it wasn't
already registered, recurse again. This prevents missing possible
updates that could have happened in the time window between the
reading of the file and the registration of the watcher.

However, the previous implementation was lacking a return statement,
hence causing the add notification to be actually triggered twice,
if the two iterations read two different versions of the file.
Practically speaking, this is extremely unlikely to lead to actual
issues, unless multiple back-to-back changes are performed in sequence
(as we do in the unit tests).

Regardless, let's fix it by adding the missing return statement.

Fixes: 106d0981ee35 ("clustermesh: fix config watcher race condition with back-to-back changes")
Signed-off-by: Marco Iorio <marco.iorio@isovalent.com>
1 parent db1cd13
History
File Mode Size
.gitignore -rw-r--r-- 21 bytes
Makefile -rw-r--r-- 435 bytes
main.go -rw-r--r-- 934 bytes

back to top