]> 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)
committerJason Dillaman <dillaman@redhat.com>
Wed, 29 Jul 2020 12:45:51 +0000 (08:45 -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>
src/librbd/ImageCtx.cc

index ddfa8efc7689455b76e58a0b091df16f3fe9553a..e780cea9635b78811439235704035209b2577608 100644 (file)
@@ -724,6 +724,8 @@ librados::IoCtx duplicate_io_ctx(librados::IoCtx& io_ctx) {
                                 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;
@@ -762,6 +764,8 @@ librados::IoCtx duplicate_io_ctx(librados::IoCtx& io_ctx) {
       }
     }
 
+    image_locker.unlock();
+
 #define ASSIGN_OPTION(param, type)              \
     param = config.get_val<type>("rbd_"#param)