From 903bccf1bbf0268450df26247870dbea38188440 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 27 Jul 2020 14:36:49 -0400 Subject: [PATCH] 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 --- src/librbd/ImageCtx.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 8375d1a639064..bbe3471d8665d 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) -- 2.39.5