]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/extent_placement_manager: make reserve and block atomic
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 29 Apr 2024 03:03:02 +0000 (11:03 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 23 May 2024 14:11:11 +0000 (17:11 +0300)
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
(cherry picked from commit 71461dafdfb59df8e385f9b276576564cfeddb02)

src/crimson/os/seastore/extent_placement_manager.cc

index 5f967e444d76ff6606a77a98b694b030d5360ef6..c5b5751bdb302043ad4b8d8669e8e465eea9493a 100644 (file)
@@ -524,11 +524,10 @@ ExtentPlacementManager::BackgroundProcess::reserve_projected_usage(
     ++stats.io_blocked_count;
     stats.io_blocked_sum += stats.io_blocking_num;
 
-    return seastar::repeat([this, usage, FNAME] {
-      DEBUG("setup and wait blocking_io...");
-      blocking_io = seastar::promise<>();
-      return blocking_io->get_future(
-      ).then([this, usage, FNAME] {
+    blocking_io = seastar::promise<>();
+    return blocking_io->get_future(
+    ).then([this, usage, FNAME] {
+      return seastar::repeat([this, usage, FNAME] {
         ceph_assert(!blocking_io);
         auto res = try_reserve_io(usage);
         if (res.is_successful()) {
@@ -544,8 +543,12 @@ ExtentPlacementManager::BackgroundProcess::reserve_projected_usage(
                 res.cleaner_result.reserve_cold_success,
                 usage);
           abort_io_usage(usage, res);
-          return seastar::make_ready_future<seastar::stop_iteration>(
-            seastar::stop_iteration::no);
+          blocking_io = seastar::promise<>();
+          return blocking_io->get_future(
+          ).then([] {
+            return seastar::make_ready_future<seastar::stop_iteration>(
+              seastar::stop_iteration::no);
+          });
         }
       });
     });