]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: handle possible aio_read return error code
authorJason Dillaman <dillaman@redhat.com>
Mon, 2 Mar 2015 13:13:55 +0000 (08:13 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 3 Mar 2015 02:18:39 +0000 (21:18 -0500)
AioRead and CopyupRequest were not properly handling possible
error codes from aio_read.  They now correctly free the completion
and invoke the callback context.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/AioRequest.cc
src/librbd/CopyupRequest.cc

index 5b18bdf76261bb776be864bd0221ddfa58718df4..1e6a28d1c51bcaa1595b3233dc11a7fd95c8f595 100644 (file)
@@ -68,8 +68,15 @@ namespace librbd {
                           << " parent completion " << m_parent_completion
                           << " extents " << image_extents
                           << dendl;
-    aio_read(m_ictx->parent, image_extents, NULL, &m_read_data,
-            m_parent_completion, 0);
+    int r = aio_read(m_ictx->parent, image_extents, NULL, &m_read_data,
+                    m_parent_completion, 0);
+    if (r < 0) {
+      lderr(m_ictx->cct) << "read_from_parent " << this
+                         << ": error reading from parent: "
+                         << cpp_strerror(r) << dendl;
+      m_parent_completion->release();
+      complete(r);
+    }
   }
 
   static inline bool is_copy_on_read(ImageCtx *ictx, librados::snap_t snap_id) {
index 12f938a52991d7736bf12f838777e060bd8633b4..687dbe1ce0e16706fcdab52156048847077c4243 100644 (file)
@@ -94,10 +94,11 @@ namespace librbd {
     int r = aio_read(m_ictx->parent, m_image_extents, NULL, &m_copyup_data,
                     comp, 0);
     if (r < 0) {
+      lderr(m_ictx->cct) << __func__ << " " << this
+                         << ": error reading from parent: "
+                         << cpp_strerror(r) << dendl;
       comp->release();
-
-      remove_from_list();
-      complete_requests(r);
+      complete(r);
     }
   }