]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
seastore: prevent re-entering do_gc_cycle() when run_until_halt is called
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 9 Aug 2022 09:49:51 +0000 (18:49 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Fri, 12 Aug 2022 01:21:37 +0000 (10:21 +0900)
Signed-off-by: Myoungwon Oh <myoungwon.oh@samsung.com>
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/async_cleaner.h

index 528e569c1b258a04fded394f2c04c539e2ce48f7..653ce6ca2b1d495ffbe4eab6ac4162ae9722d4bd 100644 (file)
@@ -1097,6 +1097,7 @@ private:
          return blocking->get_future();
        });
     }
+    bool is_running_until_halt = false;
   public:
     GCProcess(AsyncCleaner &cleaner) : cleaner(cleaner) {}
 
@@ -1120,14 +1121,25 @@ private:
 
     gc_cycle_ret run_until_halt() {
       ceph_assert(is_stopping());
+      if (is_running_until_halt) {
+       return seastar::now();
+      }
+      is_running_until_halt = true;
       return seastar::do_until(
        [this] {
          cleaner.log_gc_state("GCProcess::run_until_halt");
-         return !cleaner.gc_should_run();
+         assert(is_running_until_halt);
+         if (cleaner.gc_should_run()) {
+           return false;
+         } else {
+           is_running_until_halt = false;
+           return true;
+         }
        },
        [this] {
          return cleaner.do_gc_cycle();
-       });
+       }
+      );
     }
 
     void maybe_wake_on_space_used() {