From 1bfd760898dfe97f95333eeef94bb9111dfed4a3 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 2 Mar 2015 08:13:55 -0500 Subject: [PATCH] librbd: handle possible aio_read return error code 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 --- src/librbd/AioRequest.cc | 11 +++++++++-- src/librbd/CopyupRequest.cc | 7 ++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/librbd/AioRequest.cc b/src/librbd/AioRequest.cc index 5b18bdf76261b..1e6a28d1c51bc 100644 --- a/src/librbd/AioRequest.cc +++ b/src/librbd/AioRequest.cc @@ -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) { diff --git a/src/librbd/CopyupRequest.cc b/src/librbd/CopyupRequest.cc index 12f938a52991d..687dbe1ce0e16 100644 --- a/src/librbd/CopyupRequest.cc +++ b/src/librbd/CopyupRequest.cc @@ -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); } } -- 2.39.5