]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/common: trace management of interrupt_cond in interruptor::async()
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Mon, 5 Dec 2022 19:51:14 +0000 (19:51 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 Feb 2023 16:22:04 +0000 (16:22 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/common/interruptible_future.h

index c7cfcadd48149780fb09a51ab4784589326d9657..6ae8689357be1a3694b307d6e03b5e5308ae5f56 100644 (file)
@@ -96,6 +96,11 @@ struct interrupt_cond_t {
   uint64_t ref_count = 0;
   void set(
     InterruptCondRef<InterruptCond>& ic) {
+    INTR_FUT_DEBUG(
+      "{}: going to set interrupt_cond: {}, ic: {}",
+      __func__,
+      (void*)interrupt_cond.get(),
+      (void*)ic.get());
     if (!interrupt_cond) {
       interrupt_cond = ic;
     }
@@ -1388,12 +1393,24 @@ public:
   template <typename Func,
            typename Result = futurize_t<std::invoke_result_t<Func>>>
   static inline Result async(Func&& func) {
-    return seastar::async([func=std::forward<Func>(func),
-                          interrupt_condition=interrupt_cond<InterruptCond>.interrupt_cond]
-                         () mutable {
+    auto interruption_condition = interrupt_cond<InterruptCond>.interrupt_cond;
+    INTR_FUT_DEBUG(
+      "interruptible_future_detail::async() yielding out, "
+      "interrupt_cond {},{} cleared",
+      (void*)interruption_condition.get(),
+      typeid(InterruptCond).name());
+    interrupt_cond<InterruptCond>.reset();
+    auto ret = seastar::async([func=std::forward<Func>(func),
+                              interruption_condition] () mutable {
       return non_futurized_call_with_interruption(
-         interrupt_condition, std::forward<Func>(func));
+         interruption_condition, std::forward<Func>(func));
     });
+    interrupt_cond<InterruptCond>.set(interruption_condition);
+    INTR_FUT_DEBUG(
+      "interruptible_future_detail::async() yield back, interrupt_cond: {},{}",
+      (void*)interrupt_cond<InterruptCond>.interrupt_cond.get(),
+      typeid(InterruptCond).name());
+    return ret;
   }
 
   static void yield() {