]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds/quiesce: agent: avoid a race condition with rapid db updates 56984/head
authorLeonid Usov <leonid.usov@ibm.com>
Wed, 17 Apr 2024 11:49:34 +0000 (14:49 +0300)
committerLeonid Usov <leonid.usov@ibm.com>
Thu, 18 Apr 2024 13:16:26 +0000 (16:16 +0300)
commitff0a71265eaa0c9dd2888292688561f571fd01d6
tree3bc8aa80bd115682dd7769ff1a7b6a65ed6d788d
parent3c3b4848800689d63ba471eacb6b6ef0ba05938d
mds/quiesce: agent: avoid a race condition with rapid db updates

When new roots begin processing but don't yet make it into the
currently tracked set, there is a window for the next update
with the same roots to treat them as new.

We fix it by simplifying the agent model, getting rid of
the intermediate `working` set. Since we never remove or add
items into the current roots collection, it's safe to update the
current set directly from the pending set.

The race was due to the fact that `db_update()` relied on the `current`
to deduce new roots into `pending`, while the same new root
could have already been seen and posted into the `working` set.
This would lead to submitting the same new root twice.
Without the `working` set such race isn't possible.

Fixes: https://tracker.ceph.com/issues/65570
Original-Issue: https://tracker.ceph.com/issues/65545
Original-PR: https://github.com/ceph/ceph/pull/56956
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
(cherry picked from commit 2a3faf1a0b65fbd62e6be688b702af94103b0106)
src/mds/MDSRankQuiesce.cc
src/mds/QuiesceAgent.cc
src/mds/QuiesceAgent.h
src/test/mds/TestQuiesceAgent.cc