]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: fold complete_event_socket() into notify_callbacks_complete()
authorIlya Dryomov <idryomov@gmail.com>
Mon, 15 Jul 2024 09:28:12 +0000 (11:28 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 15 Jul 2024 09:36:26 +0000 (11:36 +0200)
Since commit 50694f790245 ("librbd: fix race condition with AIO
completion callbacks"), the former is always called before the latter.
Move event socket notification code into notify_callbacks_complete()
and rename it to mark_complete_and_notify().

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/io/AioCompletion.cc
src/librbd/io/AioCompletion.h

index c04b80770f9998e9f9fac47941c25595d08028b1..7164d98c2594eddbb26af4e8da9b28dc14f40a21 100644 (file)
@@ -103,12 +103,10 @@ void AioCompletion::complete() {
       complete_external_callback();
     } else {
       complete_cb(rbd_comp, complete_arg);
-      complete_event_socket();
-      notify_callbacks_complete();
+      mark_complete_and_notify();
     }
   } else {
-    complete_event_socket();
-    notify_callbacks_complete();
+    mark_complete_and_notify();
   }
 
   tracepoint(librbd, aio_complete_exit);
@@ -259,20 +257,17 @@ void AioCompletion::complete_external_callback() {
   // from multiple librbd-internal threads.
   boost::asio::dispatch(ictx->asio_engine->get_api_strand(), [this]() {
       complete_cb(rbd_comp, complete_arg);
-      complete_event_socket();
-      notify_callbacks_complete();
+      mark_complete_and_notify();
       put();
     });
 }
 
-void AioCompletion::complete_event_socket() {
+void AioCompletion::mark_complete_and_notify() {
   if (ictx != nullptr && event_notify && ictx->event_socket.is_valid()) {
     ictx->event_socket_completions.push(this);
     ictx->event_socket.notify();
   }
-}
 
-void AioCompletion::notify_callbacks_complete() {
   state = AIO_STATE_COMPLETE;
 
   {
index 4ae93fe36d209426e6c4fbc13238b272f13aeb28..9afced7e2be95ac19dbc507e27ba63d2c2a5e50b 100644 (file)
@@ -180,8 +180,7 @@ struct AioCompletion {
 private:
   void queue_complete();
   void complete_external_callback();
-  void complete_event_socket();
-  void notify_callbacks_complete();
+  void mark_complete_and_notify();
 };
 
 class C_AioRequest : public Context {