]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: guard non-pg-op handling with with_sequencer()
authorKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 10:25:55 +0000 (18:25 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 16 Jun 2021 12:28:01 +0000 (20:28 +0800)
because we should only ensure the ordering of the requests touching
the objects, the other requests like pgls should not be ordered along
with them. so as the second step, guard the non-pg-op handling with
with_sequencer().

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/osd/osd_operations/client_request.cc

index b52c49288379246829ce7b834df37d402d0bafa8..9b3735bf3cf68bb00729d01a82edd71365cb92e7 100644 (file)
@@ -87,8 +87,9 @@ seastar::future<> ClientRequest::start()
        return interruptor::with_interruption([this, pgref]() mutable {
           epoch_t same_interval_since = pgref->get_interval_start_epoch();
           logger().debug("{} same_interval_since: {}", *this, same_interval_since);
-          return with_sequencer(
-            interruptor::wrap_function([this, pgref]() -> interruptible_future<> {
+          const bool has_pg_op = is_pg_op();
+          auto interruptible_do_op =
+            interruptor::wrap_function([this, has_pg_op, pgref]() -> interruptible_future<> {
               PG &pg = *pgref;
               if (pg.can_discard_op(*m)) {
                 return osd.send_incremental_map(conn, m->get_map_epoch());
@@ -104,20 +105,22 @@ seastar::future<> ClientRequest::start()
               }).then_interruptible([this, &pg]() {
                 return with_blocking_future_interruptible<IOInterruptCondition>(
                     pg.wait_for_active_blocker.wait());
-              }).then_interruptible([this, pgref=std::move(pgref)]() mutable {
+              }).then_interruptible([this, has_pg_op, pgref=std::move(pgref)]() mutable {
                 if (m->finish_decode()) {
                   m->clear_payload();
                 }
-                if (is_pg_op()) {
-                  return process_pg_op(pgref);
-                } else {
-                  return process_op(pgref);
-                }
+                return (has_pg_op ?
+                        process_pg_op(pgref) :
+                        process_op(pgref));
               });
-            })
-          ).then_interruptible([pgref]() {
-            return seastar::stop_iteration::yes;
-          });
+            });
+          // keep the ordering of non-pg ops when across pg internvals
+          return (has_pg_op ?
+                  interruptible_do_op() :
+                  with_sequencer(std::move(interruptible_do_op)))
+            .then_interruptible([pgref]() {
+              return seastar::stop_iteration::yes;
+            });
        }, [this, pgref](std::exception_ptr eptr) {
           if (should_abort_request(*this, std::move(eptr))) {
             sequencer.abort();