]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: skip cache initialization if data IoCtx is invalid 37286/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 21 Sep 2020 18:05:17 +0000 (14:05 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 24 Sep 2020 13:13:49 +0000 (09:13 -0400)
This resolves the potential for an assertion failure in the cache
constructors that occurs when the data IoCtx is not valid. Errors
are deferred until actual IOs are issued against the invalid data
pool.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/image/OpenRequest.cc
src/librbd/plugin/ParentCache.cc

index 046d37d4ba7ca74529d87756dea4016a4db20956..9b8e098108339cd0fda8402e694ed555fbd242e6 100644 (file)
@@ -558,8 +558,8 @@ Context* OpenRequest<I>::handle_init_plugin_registry(int *result) {
 
 template <typename I>
 Context *OpenRequest<I>::send_init_cache(int *result) {
-  // cache is disabled or parent image context
-  if (!m_image_ctx->cache || m_image_ctx->child != nullptr) {
+  if (!m_image_ctx->cache || m_image_ctx->child != nullptr ||
+      !m_image_ctx->data_ctx.is_valid()) {
     return send_register_watch(result);
   }
 
index 9e1197933f59edfbed4a1113f0781b52416b598c..0c50c8e7197055d6cd6f91a767ad6e91d818a868 100644 (file)
@@ -38,7 +38,8 @@ void ParentCache<I>::init(I* image_ctx, Api<I>& api, HookPoints* hook_points,
   m_image_ctx = image_ctx;
   bool parent_cache_enabled = m_image_ctx->config.template get_val<bool>(
     "rbd_parent_cache_enabled");
-  if (m_image_ctx->child == nullptr || !parent_cache_enabled) {
+  if (m_image_ctx->child == nullptr || !parent_cache_enabled ||
+      !m_image_ctx->data_ctx.is_valid()) {
     on_finish->complete(0);
     return;
   }