From: Jason Dillaman Date: Tue, 30 Apr 2019 15:10:09 +0000 (-0400) Subject: librbd: AioCompletion fail path should complete in clean thread X-Git-Tag: v15.1.0~2767^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e2ee3cd50c96bdcaab19ef9a68dc92cf54a35904;p=ceph.git librbd: AioCompletion fail path should complete in clean thread Ensure that no internal librbd locks are being held when the callbacks are invoked for AioCompletion::fail. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc index b282397f01d1..610435aceefe 100644 --- a/src/librbd/io/AioCompletion.cc +++ b/src/librbd/io/AioCompletion.cc @@ -146,12 +146,11 @@ void AioCompletion::fail(int r) CephContext *cct = ictx->cct; lderr(cct) << cpp_strerror(r) << dendl; - ceph_assert(pending_count == 0); + uint32_t previous_pending_count = pending_count.exchange(1); + ceph_assert(previous_pending_count == 0); - get(); - rval = r; - complete(); - put(); + // ensure completion fires in clean lock context + ictx->op_work_queue->queue(new C_AioRequest(this), r); } void AioCompletion::set_request_count(uint32_t count) {