Skip to content

Commit

Permalink
test/librados_test_stub: raise a watch error on blocklisting
Browse files Browse the repository at this point in the history
Simulate getting MWatchNotify CEPH_WATCH_EVENT_DISCONNECT message after
the client is blocklisted.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
  • Loading branch information
idryomov committed Apr 4, 2023
1 parent 6a0aead commit 0dfe87d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/test/librados_test_stub/TestWatchNotify.cc
Expand Up @@ -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;
Expand Down

0 comments on commit 0dfe87d

Please sign in to comment.