From 3e16fc42172e202b487426451dbd91472d71c1c2 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 25 Aug 2020 15:37:40 -0400 Subject: [PATCH] librbd: abort image open if specified plugin failed to load This will avoid silently failing to load a specified plugin. Signed-off-by: Jason Dillaman --- src/librbd/PluginRegistry.cc | 2 +- src/librbd/image/OpenRequest.cc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librbd/PluginRegistry.cc b/src/librbd/PluginRegistry.cc index c600c860ffdb8..90ebdbb203ebe 100644 --- a/src/librbd/PluginRegistry.cc +++ b/src/librbd/PluginRegistry.cc @@ -35,7 +35,7 @@ void PluginRegistry::init(const std::string& plugins, Context* on_finish) { plugin_registry->get_with_load("librbd", "librbd_" + token)); if (plugin == nullptr) { lderr(cct) << "failed to load plugin: " << token << dendl; - ctx->complete(-ENOENT); + ctx->complete(-ENOSYS); break; } diff --git a/src/librbd/image/OpenRequest.cc b/src/librbd/image/OpenRequest.cc index 2c19d5b930edc..046d37d4ba7ca 100644 --- a/src/librbd/image/OpenRequest.cc +++ b/src/librbd/image/OpenRequest.cc @@ -549,6 +549,8 @@ Context* OpenRequest::handle_init_plugin_registry(int *result) { if (*result < 0) { lderr(cct) << "failed to initialize plugin registry: " << cpp_strerror(*result) << dendl; + send_close_image(*result); + return nullptr; } return send_init_cache(result); -- 2.39.5