From: Jason Dillaman Date: Tue, 14 Jun 2016 00:20:33 +0000 (-0400) Subject: librbd: track in-flight flush events for journaling X-Git-Tag: v10.2.2~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F9691%2Fhead;p=ceph.git librbd: track in-flight flush events for journaling The tracking for flush events was accidentally dropped. This can result in the journal being closed too early since it might miss in-flight flush ops. Signed-off-by: Jason Dillaman (cherry picked from commit a1ea1edce9332fa1730625629e3b4e16f02caaf4) --- diff --git a/src/librbd/AioCompletion.cc b/src/librbd/AioCompletion.cc index db4b2ca74feb..1e892acb7947 100644 --- a/src/librbd/AioCompletion.cc +++ b/src/librbd/AioCompletion.cc @@ -135,11 +135,11 @@ namespace librbd { } } - void AioCompletion::start_op() { + void AioCompletion::start_op(bool ignore_type) { Mutex::Locker locker(lock); assert(ictx != nullptr); assert(!async_op.started()); - if (state == STATE_PENDING && aio_type != AIO_TYPE_FLUSH) { + if (state == STATE_PENDING && (ignore_type || aio_type != AIO_TYPE_FLUSH)) { async_op.start_op(*ictx); } } diff --git a/src/librbd/AioCompletion.h b/src/librbd/AioCompletion.h index 37d8977be95e..758b1d8a6693 100644 --- a/src/librbd/AioCompletion.h +++ b/src/librbd/AioCompletion.h @@ -118,7 +118,7 @@ namespace librbd { void finalize(ssize_t rval); void init_time(ImageCtx *i, aio_type_t t); - void start_op(); + void start_op(bool ignore_type = false); void fail(int r); void complete(); diff --git a/src/librbd/AioImageRequest.cc b/src/librbd/AioImageRequest.cc index 3b2868801da1..1877af146965 100644 --- a/src/librbd/AioImageRequest.cc +++ b/src/librbd/AioImageRequest.cc @@ -472,6 +472,8 @@ void AioImageFlush::send_request() { C_AioRequest *req_comp = new C_AioRequest(m_aio_comp); m_image_ctx.flush(req_comp); + // track flush op for block writes + m_aio_comp->start_op(true); m_aio_comp->put(); m_image_ctx.perfcounter->inc(l_librbd_aio_flush);