From: Jason Dillaman Date: Mon, 27 Jul 2020 18:36:49 +0000 (-0400) Subject: librbd: hold ImageCtx::md_lock while computing config overrides X-Git-Tag: v14.2.12~121^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=903bccf1bbf0268450df26247870dbea38188440;p=ceph.git librbd: hold ImageCtx::md_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) (cherry picked from commit 652952f2d74df907637f03eff542a56e02a1ec8c) Conflicts: src/librbd/ImageCtx.cc: image_lock -> md_lock --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 8375d1a63906..bbe3471d8665 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -735,6 +735,8 @@ public: bool thread_safe) { ldout(cct, 20) << __func__ << dendl; + RWLock::WLocker md_locker(md_lock); + // reset settings back to global defaults for (auto& key : config_overrides) { std::string value; @@ -773,6 +775,8 @@ public: } } + md_locker.unlock(); + #define ASSIGN_OPTION(param, type) \ param = config.get_val("rbd_"#param)