]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
extblkdev: Make preload one-time function
authorAdam Kupczyk <akupczyk@ibm.com>
Tue, 10 Feb 2026 12:16:46 +0000 (12:16 +0000)
committerAdam Kupczyk <akupczyk@ibm.com>
Wed, 25 Mar 2026 09:35:04 +0000 (09:35 +0000)
Subsequent calls to extblkdev::preload() do not do anything.
It is assumed that first call already loads all plugins that could be
loaded.

Signed-off-by: Adam Kupczyk <akupczyk@ibm.com>
src/extblkdev/ExtBlkDevPlugin.cc

index eea37e59b47582713481f22ed51b4a9de66bcfd2..0861c02000031db1dac6433ee955c3cbcb322401 100644 (file)
@@ -184,6 +184,17 @@ namespace ceph {
     // preload set of extblkdev plugins defined in config
     int preload(CephContext *cct)
     {
+      static bool preload_executed = false;
+      static int preload_result = -1;
+      if (preload_executed) {
+        auto registry = cct->get_plugin_registry();
+        std::lock_guard l(registry->lock);
+        dout(10) << "plugins preload done, extblkdev plugins ="
+          << registry->plugins["extblkdev"].size()
+          << " previous_result = " << preload_result << dendl;
+        return preload_result;
+      }
+      preload_executed = true;
       const auto& conf = cct->_conf;
       string plugins = conf.get_val<std::string>("osd_extblkdev_plugins");
       dout(10) << "starting preload of extblkdev plugins: " << plugins << dendl;
@@ -199,8 +210,9 @@ namespace ceph {
          int rc = registry->load("extblkdev", std::string("ebd_") + plg);
          if (rc) {
            derr << __func__ << " failed preloading extblkdev plugin: " << plg << dendl;
+            preload_result = rc;
            return rc;
-         }else{
+         } else {
            dout(10) << "successful load of extblkdev plugin: " << plg << dendl;
          }
        }
@@ -209,10 +221,12 @@ namespace ceph {
       // if we are still running as root, we do not need to trim capabilities
       // as we are intended to use the privileges
       if (geteuid() == 0) {
+        preload_result = 0;
        return 0;
       }
       return limit_caps(cct);
 #else
+      preload_result = 0;
       return 0;
 #endif
     }