]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: abort image open if specified plugin failed to load
authorJason Dillaman <dillaman@redhat.com>
Tue, 25 Aug 2020 19:37:40 +0000 (15:37 -0400)
committerJason Dillaman <dillaman@redhat.com>
Tue, 25 Aug 2020 20:12:55 +0000 (16:12 -0400)
This will avoid silently failing to load a specified plugin.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/PluginRegistry.cc
src/librbd/image/OpenRequest.cc

index c600c860ffdb8084ed75826e5aa0208e786c9798..90ebdbb203ebe7f81ee1e45e594ddb04be2f9bb9 100644 (file)
@@ -35,7 +35,7 @@ void PluginRegistry<I>::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;
     }
 
index 2c19d5b930edca549cd08f66abda4d41249ac1b1..046d37d4ba7ca74529d87756dea4016a4db20956 100644 (file)
@@ -549,6 +549,8 @@ Context* OpenRequest<I>::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);