From fcd414f6324136ce0695fcf30a60eec6ff338a98 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Wed, 2 May 2018 12:52:42 -0400 Subject: [PATCH] osdc: invoke notify finish context on linger commit failure Fixes: http://tracker.ceph.com/issues/23966 Signed-off-by: Jason Dillaman --- src/librados/IoCtxImpl.cc | 8 ++------ src/osdc/Objecter.cc | 8 ++++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/librados/IoCtxImpl.cc b/src/librados/IoCtxImpl.cc index bb8a0795771b7..668eb2f7bd110 100644 --- a/src/librados/IoCtxImpl.cc +++ b/src/librados/IoCtxImpl.cc @@ -138,7 +138,7 @@ struct C_aio_notify_Complete : public C_aio_linger_Complete { } void complete(int r) override { - // invoked by C_notify_Finish (or C_aio_notify_Ack on failure) + // invoked by C_notify_Finish lock.Lock(); finished = true; complete_unlock(r); @@ -175,10 +175,6 @@ struct C_aio_notify_Ack : public Context { ldout(cct, 10) << __func__ << " linger op " << oncomplete->linger_op << " " << "acked (" << r << ")" << dendl; oncomplete->handle_ack(r); - if (r < 0) { - // on failure, we won't expect to see a notify_finish callback - onfinish->complete(r); - } } }; @@ -1832,6 +1828,7 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl, Context *notify_finish = new C_notify_Finish(client->cct, ¬ify_finish_cond, objecter, linger_op, preply_bl, preply_buf, preply_buf_len); + (void) notify_finish; uint32_t timeout = notify_timeout; if (timeout_ms) @@ -1863,7 +1860,6 @@ int librados::IoCtxImpl::notify(const object_t& oid, bufferlist& bl, } else { ldout(client->cct, 10) << __func__ << " failed to initiate notify, r = " << r << dendl; - notify_finish->complete(r); } objecter->linger_cancel(linger_op); diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index b7220aa0100cb..20d5b682e9030 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -592,6 +592,10 @@ void Objecter::_linger_commit(LingerOp *info, int r, bufferlist& outbl) info->on_reg_commit->complete(r); info->on_reg_commit = NULL; } + if (r < 0 && info->on_notify_finish) { + info->on_notify_finish->complete(r); + info->on_notify_finish = nullptr; + } // only tell the user the first time we do this info->registered = true; @@ -1654,6 +1658,10 @@ void Objecter::_check_linger_pool_dne(LingerOp *op, bool *need_unregister) op->on_reg_commit->complete(-ENOENT); op->on_reg_commit = nullptr; } + if (op->on_notify_finish) { + op->on_notify_finish->complete(-ENOENT); + op->on_notify_finish = nullptr; + } *need_unregister = true; } } else { -- 2.39.5