]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/crimson/seastore: teardown in reactor
authorKefu Chai <kchai@redhat.com>
Wed, 19 May 2021 10:02:59 +0000 (18:02 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 20 May 2021 05:10:03 +0000 (13:10 +0800)
otherwise, we rely on the destructor of TMTestState to teardown the
fixuture created in TMTestState::_init(), but TMTestState::_init() is
called in reactor. the objects like seastar::metric_groups are
supposed to be destroyed on the same thread where they are created.
because they use thread local storage of storing persisting their status.
if we destroy objects like seastar::metric_groups on different reactor
or thread where they are created, we would have memory leak and
unexpected behavior.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/crimson/seastore/transaction_manager_test_state.h

index 1d40279d818cdbab90d813caf2832a137b0444cf..9a1c51fdcbb7e57f5fbd8ee523d018646a832851 100644 (file)
@@ -120,8 +120,10 @@ protected:
   }
 
   virtual seastar::future<> _teardown() {
-    return tm->close(
-    ).handle_error(
+    return tm->close().safe_then([this] {
+      _destroy();
+      return seastar::now();
+    }).handle_error(
       crimson::ct_error::assert_all{"Error in teardown"}
     );
   }
@@ -199,7 +201,9 @@ protected:
   }
 
   virtual seastar::future<> _teardown() {
-    return seastore->umount();
+    return seastore->umount().then([this] {
+      seastore.reset();
+    });
   }
 
   virtual seastar::future<> _mount() {