]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: do not share crypto image layers with ancestors 39044/head
authorOr Ozeri <oro@il.ibm.com>
Sun, 24 Jan 2021 07:32:44 +0000 (09:32 +0200)
committerOr Ozeri <oro@il.ibm.com>
Sun, 24 Jan 2021 07:32:44 +0000 (09:32 +0200)
This commit creates a unique crypto image dispatch per image,
instead of sharing a single object with all ancestors.
This should fix a seg-fault caused when closing an encrypted cloned image.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
src/librbd/crypto/LoadRequest.cc

index 2e5cb023c65de3fa361db0ec68009873e5b4aecd..591e08d57a01eec68f6d9541e086e99253d48a39 100644 (file)
@@ -59,12 +59,12 @@ template <typename I>
 void LoadRequest<I>::finish(int r) {
   if (r == 0) {
     // load crypto layers to image and its ancestors
-    auto image_dispatch = CryptoImageDispatch::create(
-            m_crypto->get_data_offset());
     auto ictx = m_image_ctx;
     while (ictx != nullptr) {
       auto object_dispatch = CryptoObjectDispatch<I>::create(
               ictx, m_crypto);
+      auto image_dispatch = CryptoImageDispatch::create(
+            m_crypto->get_data_offset());
       ictx->io_object_dispatcher->register_dispatch(object_dispatch);
       ictx->io_image_dispatcher->register_dispatch(image_dispatch);