From: Or Ozeri Date: Sun, 24 Jan 2021 07:32:44 +0000 (+0200) Subject: librbd: do not share crypto image layers with ancestors X-Git-Tag: v17.1.0~3169^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F39044%2Fhead;p=ceph.git librbd: do not share crypto image layers with ancestors 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 --- diff --git a/src/librbd/crypto/LoadRequest.cc b/src/librbd/crypto/LoadRequest.cc index 2e5cb023c65d..591e08d57a01 100644 --- a/src/librbd/crypto/LoadRequest.cc +++ b/src/librbd/crypto/LoadRequest.cc @@ -59,12 +59,12 @@ template void LoadRequest::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::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);