]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mgr/cephadm: make cache invalidate less racy
authorSage Weil <sage@redhat.com>
Fri, 21 Feb 2020 21:38:25 +0000 (15:38 -0600)
committerSage Weil <sage@redhat.com>
Mon, 24 Feb 2020 16:35:26 +0000 (10:35 -0600)
commit8095d94124482333c71fb4c2561a6d6a5624b5c1
treeb94469ab5b94cbcfd5341241af0f8703937df989
parent8525de44b46a78129ffcf0665f1639fd73a19c80
mgr/cephadm: make cache invalidate less racy

Consider a cache invalidation that races with an actual update:

- serve() refresh starts
- refresh runs cephadm ls
- add_daemon creates a new daemon
- add_daemon returns and invalidates the list (set last_udpate=None)
- serve() stores its ls result in the cache

In such a case the add result will get lost.

Fix this by taking a conservative strategy:

- invalidate adds host to a refresh list
- serve() removes an item from the refresh list and then does the ls,
then stores the result.

Any racing update will invalidate *after* it does it's work, which means
we will always do a final ls afterwards.

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py