From: Lucian Petrut Date: Fri, 29 Jan 2021 11:03:20 +0000 (+0000) Subject: rbd: propagate WNBD start errors X-Git-Tag: v16.2.0~209^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2afa5ca067d004a9603601a5460020d9f2ddea97;p=ceph.git rbd: propagate WNBD start errors 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 (cherry picked from commit afa7b532b2b53ba3734e13f5f72213cbe6ba22fd) --- diff --git a/src/tools/rbd_wnbd/rbd_wnbd.cc b/src/tools/rbd_wnbd/rbd_wnbd.cc index 5d45fa75fa66..a4b0cf29bd0f 100644 --- a/src/tools/rbd_wnbd/rbd_wnbd.cc +++ b/src/tools/rbd_wnbd/rbd_wnbd.cc @@ -1131,7 +1131,11 @@ static int do_map(Config *cfg) g_conf().get_val("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;