]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: hold ImageCtx::md_lock while computing config overrides
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Jul 2020 18:36:49 +0000 (14:36 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 19 Aug 2020 20:22:08 +0000 (16:22 -0400)
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 <dillaman@redhat.com>
(cherry picked from commit c7104d18e190f3718ec1625376f8c63676096efa)
(cherry picked from commit 652952f2d74df907637f03eff542a56e02a1ec8c)

Conflicts:
src/librbd/ImageCtx.cc: image_lock -> md_lock

src/librbd/ImageCtx.cc

index 8375d1a6390647ff63d4e552c5a70861b69612b2..bbe3471d8665de533ab7c22128ceeb5620c5fa4f 100644 (file)
@@ -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<type>("rbd_"#param)