]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: AioCompletion fail path should complete in clean thread
authorJason Dillaman <dillaman@redhat.com>
Tue, 30 Apr 2019 15:10:09 +0000 (11:10 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 2 May 2019 13:30:45 +0000 (09:30 -0400)
Ensure that no internal librbd locks are being held when the
callbacks are invoked for AioCompletion::fail.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/io/AioCompletion.cc

index b282397f01d19d7920b2dec009c5e98a6d25ee07..610435aceefeb0b42d2da6819cf56b6046b45bb9 100644 (file)
@@ -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) {