Merge pull request #35301 from dillaman/wip-45715

librbd: Watcher should not attempt to re-watch after detecting blacklisting

Reviewed-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
Mykola Golub 2020-05-30 14:46:49 +03:00 committed by GitHub
commit 64aa6910df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 13 deletions

View File

@ -324,7 +324,7 @@ void Watcher::handle_rewatch_callback(int r) {
if (m_unregister_watch_ctx != nullptr) {
m_watch_state = WATCH_STATE_IDLE;
std::swap(unregister_watch_ctx, m_unregister_watch_ctx);
} else if (r == -ENOENT) {
} else if (r == -EBLACKLISTED || r == -ENOENT) {
m_watch_state = WATCH_STATE_IDLE;
} else if (r < 0 || m_watch_error) {
watch_error = true;

View File

@ -293,12 +293,6 @@ TEST_F(TestMockWatcher, ReregisterWatchBlacklist) {
expect_aio_unwatch(mock_image_ctx, 0);
expect_aio_watch(mock_image_ctx, -EBLACKLISTED);
C_SaferCond blacklist_ctx;
expect_aio_watch(mock_image_ctx, 0, [&blacklist_ctx]() {
blacklist_ctx.wait();
});
expect_aio_unwatch(mock_image_ctx, 0);
C_SaferCond register_ctx;
mock_image_watcher.register_watch(&register_ctx);
ASSERT_TRUE(wait_for_watch(mock_image_ctx, 1));
@ -309,17 +303,11 @@ TEST_F(TestMockWatcher, ReregisterWatchBlacklist) {
// wait for recovery unwatch/watch
ASSERT_TRUE(wait_for_watch(mock_image_ctx, 2));
ASSERT_TRUE(mock_image_watcher.is_blacklisted());
blacklist_ctx.complete(0);
// wait for post-blacklist recovery watch
ASSERT_TRUE(wait_for_watch(mock_image_ctx, 1));
C_SaferCond unregister_ctx;
mock_image_watcher.unregister_watch(&unregister_ctx);
ASSERT_EQ(0, unregister_ctx.wait());
ASSERT_FALSE(mock_image_watcher.is_blacklisted());
}
TEST_F(TestMockWatcher, ReregisterUnwatchPendingUnregister) {