]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mds/quiesce: agent: avoid a race condition with rapid db updates 56956/head
authorLeonid Usov <leonid.usov@ibm.com>
Wed, 17 Apr 2024 11:49:34 +0000 (14:49 +0300)
committerLeonid Usov <leonid.usov@ibm.com>
Wed, 17 Apr 2024 13:52:38 +0000 (16:52 +0300)
commit2a3faf1a0b65fbd62e6be688b702af94103b0106
tree17597fc3ef4352009cdcd70e99b18247031dff8f
parent7714874efb08facee80f92b358993fa56854bb01
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/65545
Signed-off-by: Leonid Usov <leonid.usov@ibm.com>
src/mds/MDSRankQuiesce.cc
src/mds/QuiesceAgent.cc
src/mds/QuiesceAgent.h
src/test/mds/TestQuiesceAgent.cc