]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: hold ImageCtx::image_lock while computing config overrides
authorJason Dillaman <dillaman@redhat.com>
Mon, 27 Jul 2020 18:36:49 +0000 (14:36 -0400)
committerNathan Cutler <ncutler@suse.com>
Fri, 14 Aug 2020 21:21:25 +0000 (23:21 +0200)
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)

src/librbd/ImageCtx.cc

index 74bd121bad7df3b650ef189d57e7404e0cdc9d17..d83c3753062b57f97f2980eaffa3de900a89d46f 100644 (file)
@@ -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<type>("rbd_"#param)