From afa7b532b2b53ba3734e13f5f72213cbe6ba22fd Mon Sep 17 00:00:00 2001 From: Lucian Petrut Date: Fri, 29 Jan 2021 11:03:20 +0000 Subject: [PATCH] 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 --- src/tools/rbd_wnbd/rbd_wnbd.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/rbd_wnbd/rbd_wnbd.cc b/src/tools/rbd_wnbd/rbd_wnbd.cc index 5d45fa75fa6..a4b0cf29bd0 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; -- 2.39.5