]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librados_test_stub: raise a watch error on blocklisting
authorIlya Dryomov <idryomov@gmail.com>
Thu, 30 Mar 2023 16:22:24 +0000 (18:22 +0200)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 6 Apr 2023 15:44:31 +0000 (15:44 +0000)
Simulate getting MWatchNotify CEPH_WATCH_EVENT_DISCONNECT message after
the client is blocklisted.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 0dfe87d3b6ed52cee6f6660b42af42a8dd7708bb)

src/test/librados_test_stub/TestWatchNotify.cc

index 3b18026bbf0fcfa17daa422a97c503d4cd31068c..e015efc5e3ea6e625c116d96cc925c022ff9a08e 100644 (file)
@@ -402,7 +402,16 @@ void TestWatchNotify::blocklist(uint32_t nonce) {
     auto &watcher = file_it->second;
     for (auto w_it = watcher->watch_handles.begin();
          w_it != watcher->watch_handles.end();) {
-      if (w_it->second.nonce == nonce) {
+      auto& watch_handle = w_it->second;
+      if (watch_handle.nonce == nonce) {
+        auto handle = watch_handle.handle;
+        auto watch_ctx2 = watch_handle.watch_ctx2;
+        if (watch_ctx2 != nullptr) {
+          auto ctx = new LambdaContext([handle, watch_ctx2](int) {
+              watch_ctx2->handle_error(handle, -ENOTCONN);
+            });
+          watch_handle.rados_client->get_aio_finisher()->queue(ctx);
+        }
         w_it = watcher->watch_handles.erase(w_it);
       } else {
         ++w_it;