]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: propagate any image refresh errors back to caller 8791/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 27 Apr 2016 19:56:11 +0000 (15:56 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 27 Apr 2016 19:56:11 +0000 (15:56 -0400)
Previously, the saved error code was only propagated when an image
flush was required.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/image/RefreshRequest.cc
src/librbd/image/RefreshRequest.h

index ecb7cae7bdf4d2d8530037acb8b8852555405036..7d9ab78440a08306cbdb729bb396961da62dcc3a 100644 (file)
@@ -736,7 +736,14 @@ Context *RefreshRequest<I>::send_flush_aio() {
       klass, &klass::handle_flush_aio>(this);
     m_image_ctx.flush(ctx);
     return nullptr;
+  } else if (m_error_result < 0) {
+    // propagate saved error back to caller
+    Context *ctx = create_context_callback<
+      RefreshRequest<I>, &RefreshRequest<I>::handle_error>(this);
+    m_image_ctx.op_work_queue->queue(ctx, 0);
+    return nullptr;
   }
+
   return m_on_finish;
 }
 
@@ -750,8 +757,16 @@ Context *RefreshRequest<I>::handle_flush_aio(int *result) {
                << dendl;
   }
 
+  return handle_error(result);
+}
+
+template <typename I>
+Context *RefreshRequest<I>::handle_error(int *result) {
   if (m_error_result < 0) {
     *result = m_error_result;
+
+    CephContext *cct = m_image_ctx.cct;
+    ldout(cct, 10) << this << " " << __func__ << ": r=" << *result << dendl;
   }
   return m_on_finish;
 }
index 71fe50979e222921ca5f1442cb4c72e2b4beb792..fac07fbca54d6c9f7bc45ae9d0c79a93970a986d 100644 (file)
@@ -178,6 +178,8 @@ private:
   Context *send_flush_aio();
   Context *handle_flush_aio(int *result);
 
+  Context *handle_error(int *result);
+
   void save_result(int *result) {
     if (m_error_result == 0 && *result < 0) {
       m_error_result = *result;