Skip to content

Commit

Permalink
librbd: track in-flight flush events for journaling
Browse files Browse the repository at this point in the history
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 <dillaman@redhat.com>
  • Loading branch information
Jason Dillaman committed Jun 14, 2016
1 parent c5694fc commit a1ea1ed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/librbd/AioCompletion.cc
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librbd/AioCompletion.h
Expand Up @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/librbd/AioImageRequest.cc
Expand Up @@ -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);
Expand Down

0 comments on commit a1ea1ed

Please sign in to comment.