]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd: propagate WNBD start errors
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 29 Jan 2021 11:03:20 +0000 (11:03 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 3 Feb 2021 07:20:49 +0000 (07:20 +0000)
This change will propagate the errors that WNBD may return when
spinning up the IO workers.

Also, we'll avoid removing the registry record for failed
non-persistent mappings. Those will be cleaned up when the service
restarts or when explicitly unmapped.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/tools/rbd_wnbd/rbd_wnbd.cc

index 5d45fa75fa66c09b22b345a5f52ddecfba3c684f..a4b0cf29bd0ff738ca83917cdc4018e518b764d1 100644 (file)
@@ -1131,7 +1131,11 @@ static int do_map(Config *cfg)
                             g_conf().get_val<bool>("rbd_cache"),
                             cfg->io_req_workers,
                             cfg->io_reply_workers);
-  handler->start();
+  r = handler->start();
+  if (r) {
+    r = r == ERROR_ALREADY_EXISTS ? -EEXIST : -EINVAL;
+    goto close_ret;
+  }
 
   // We're informing the parent processes that the initialization
   // was successful.
@@ -1160,6 +1164,7 @@ static int do_map(Config *cfg)
   handler->wait();
   handler->shutdown();
 
+  // The registry record shouldn't be removed for (already) running mappings.
   if (!cfg->persistent) {
     dout(5) << __func__ << ": cleaning up non-persistent mapping: "
             << cfg->devpath << dendl;