]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: handle snap trim's interruption as any other error
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Thu, 22 Dec 2022 15:32:49 +0000 (15:32 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 28 Feb 2023 16:22:05 +0000 (16:22 +0000)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/osd_operations/snaptrim_event.cc
src/crimson/osd/osd_operations/snaptrim_event.h
src/crimson/osd/pg.cc

index 09f7e1f6f5828d2353bc83be03e00c3c52040b47..fc08cefa3d754f1fcd85a1739797421dcbea0d14 100644 (file)
@@ -70,7 +70,7 @@ void SnapTrimEvent::dump_detail(Formatter *f) const
   f->close_section();
 }
 
-SnapTrimEvent::remove_or_update_ertr::future<seastar::stop_iteration>
+SnapTrimEvent::snap_trim_ertr::future<seastar::stop_iteration>
 SnapTrimEvent::start()
 {
   logger().debug("{}: {}", *this, __func__);
@@ -87,7 +87,7 @@ CommonPGPipeline& SnapTrimEvent::pp()
   return pg->request_pg_pipeline;
 }
 
-SnapTrimEvent::remove_or_update_ertr::future<seastar::stop_iteration>
+SnapTrimEvent::snap_trim_ertr::future<seastar::stop_iteration>
 SnapTrimEvent::with_pg(
   ShardServices &shard_services, Ref<PG> _pg)
 {
@@ -138,7 +138,7 @@ SnapTrimEvent::with_pg(
       }).then_interruptible([&shard_services, this] (const auto& to_trim) {
         if (to_trim.empty()) {
           // the legit ENOENT -> done
-          return remove_or_update_iertr::make_ready_future<seastar::stop_iteration>(
+          return snap_trim_iertr::make_ready_future<seastar::stop_iteration>(
             seastar::stop_iteration::yes);
         }
         for (const auto& object : to_trim) {
@@ -176,16 +176,14 @@ SnapTrimEvent::with_pg(
           });
         }).safe_then_interruptible([this] {
           logger().debug("{}: all completed", *this);
-          return remove_or_update_iertr::make_ready_future<seastar::stop_iteration>(
+          return snap_trim_iertr::make_ready_future<seastar::stop_iteration>(
             seastar::stop_iteration::no);
         });
       });
     });
-  }, [this](std::exception_ptr eptr) {
-    // TODO: better debug output
+  }, [this](std::exception_ptr eptr) -> snap_trim_ertr::future<seastar::stop_iteration> {
     logger().debug("{}: interrupted {}", *this, eptr);
-    return remove_or_update_ertr::make_ready_future<seastar::stop_iteration>(
-      seastar::stop_iteration::no);
+    return crimson::ct_error::eagain::make();
   }, pg);
 }
 
index 714d2ff3af21afdf7df943869a1080e9bdfaf441..1ed95f68ce1f90671d7c2c136e75829b8c08eef3 100644 (file)
@@ -35,6 +35,10 @@ public:
   using remove_or_update_iertr =
     crimson::interruptible::interruptible_errorator<
       IOInterruptCondition, remove_or_update_ertr>;
+  using snap_trim_ertr = remove_or_update_ertr::extend<
+    crimson::ct_error::eagain>;
+  using snap_trim_iertr = remove_or_update_iertr::extend<
+    crimson::ct_error::eagain>;
 
   static constexpr OperationTypeCode type = OperationTypeCode::snaptrim_event;
 
@@ -49,8 +53,8 @@ public:
 
   void print(std::ostream &) const final;
   void dump_detail(ceph::Formatter* f) const final;
-  remove_or_update_ertr::future<seastar::stop_iteration> start();
-  remove_or_update_ertr::future<seastar::stop_iteration> with_pg(
+  snap_trim_ertr::future<seastar::stop_iteration> start();
+  snap_trim_ertr::future<seastar::stop_iteration> with_pg(
     ShardServices &shard_services, Ref<PG> pg);
 
 private:
index 6bab7c2cf819a90f3b452a4604a0c2cf36cd0a2a..9044cd393e6b9c8baa365dd57e8de1b230c57da5 100644 (file)
@@ -478,6 +478,10 @@ void PG::on_active_actmap()
             publish_stats_to_osd();
             return seastar::make_ready_future<seastar::stop_iteration>(
               seastar::stop_iteration::yes);
+          }), crimson::ct_error::eagain::handle([this] {
+            logger().info("{}: EAGAIN saw, trimming restarted", *this);
+            return seastar::make_ready_future<seastar::stop_iteration>(
+              seastar::stop_iteration::no);
           })
         );
       }).then([this, trimmed=to_trim] {