From: Ilya Dryomov Date: Tue, 4 Apr 2023 15:21:16 +0000 (+0200) Subject: test/librados_test_stub: drop watches only after actually blocklisting X-Git-Tag: v18.1.0~182^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b88e01372b50e4a47ea4aa50690efccee6d062ae;p=ceph-ci.git test/librados_test_stub: drop watches only after actually blocklisting Eliminate a race where a client is able to submit an operation after WatchCtx2::handle_error() is invoked on its watch due to blocklisting. Signed-off-by: Ilya Dryomov (cherry picked from commit a14498eff645e9e154e4d1a3cc436453b8401d89) --- diff --git a/src/test/librados_test_stub/TestMemCluster.cc b/src/test/librados_test_stub/TestMemCluster.cc index f829dd52c4e..f0995788b0f 100644 --- a/src/test/librados_test_stub/TestMemCluster.cc +++ b/src/test/librados_test_stub/TestMemCluster.cc @@ -174,10 +174,13 @@ bool TestMemCluster::is_blocklisted(uint32_t nonce) const { } void TestMemCluster::blocklist(uint32_t nonce) { - m_watch_notify.blocklist(nonce); + { + std::lock_guard locker{m_lock}; + m_blocklist.insert(nonce); + } - std::lock_guard locker{m_lock}; - m_blocklist.insert(nonce); + // after blocklisting the client, disconnect and drop its watches + m_watch_notify.blocklist(nonce); } void TestMemCluster::transaction_start(const ObjectLocator& locator) {