From: Jason Dillaman Date: Mon, 27 Jul 2020 18:36:49 +0000 (-0400) Subject: librbd: hold ImageCtx::image_lock while computing config overrides X-Git-Tag: v15.2.5~58^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=652952f2d74df907637f03eff542a56e02a1ec8c;p=ceph.git librbd: hold ImageCtx::image_lock while computing config overrides The 'ImageCtx::apply_metadata' is guaranteed to be thread-safe but a future commit will attempt to utilize the cached config override set. Signed-off-by: Jason Dillaman (cherry picked from commit c7104d18e190f3718ec1625376f8c63676096efa) --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 74bd121bad7..d83c3753062 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -727,6 +727,8 @@ public: bool thread_safe) { ldout(cct, 20) << __func__ << dendl; + std::unique_lock image_locker(image_lock); + // reset settings back to global defaults for (auto& key : config_overrides) { std::string value; @@ -765,6 +767,8 @@ public: } } + image_locker.unlock(); + #define ASSIGN_OPTION(param, type) \ param = config.get_val("rbd_"#param)