]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/async_cleaner: fix and improve update_journal_tails() 47239/head
authorYingxin Cheng <yingxin.cheng@intel.com>
Mon, 25 Jul 2022 08:28:42 +0000 (16:28 +0800)
committerYingxin Cheng <yingxin.cheng@intel.com>
Mon, 25 Jul 2022 14:23:00 +0000 (22:23 +0800)
* Accept JOURNAL_SEQ_NULL dirty_tail when it is pending.
* Enforce monotone increasing to the journal tails.
* Enforce journal tails to be always behind the journal head.

Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
src/crimson/os/seastore/async_cleaner.cc
src/crimson/os/seastore/async_cleaner.h
src/crimson/os/seastore/transaction_manager.cc

index 4a9765f61ae32075d5443f3a91b66ed4ddcd1fd3..67690e91f80993608aa599ea5d691e5e4519e2f0 100644 (file)
@@ -631,16 +631,17 @@ void AsyncCleaner::update_journal_tails(
 {
   LOG_PREFIX(AsyncCleaner::update_journal_tails);
   if (disable_trim) return;
-  assert(dirty_tail.offset.get_addr_type() != addr_types_t::RANDOM_BLOCK);
-  assert(alloc_tail.offset.get_addr_type() != addr_types_t::RANDOM_BLOCK);
 
-  ceph_assert(dirty_tail != JOURNAL_SEQ_NULL);
-  ceph_assert(alloc_tail != JOURNAL_SEQ_NULL);
-  ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
-              (journal_head >= dirty_tail && journal_head >= alloc_tail));
-
-  if (journal_dirty_tail == JOURNAL_SEQ_NULL ||
-      dirty_tail > journal_dirty_tail) {
+  if (dirty_tail != JOURNAL_SEQ_NULL) {
+    assert(dirty_tail.offset.get_addr_type() != addr_types_t::RANDOM_BLOCK);
+    ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
+                journal_head >= dirty_tail);
+    if (journal_dirty_tail != JOURNAL_SEQ_NULL &&
+        journal_dirty_tail > dirty_tail) {
+      ERROR("journal_dirty_tail {} => {} is backwards!",
+            journal_dirty_tail, dirty_tail);
+      ceph_abort();
+    }
     if (journal_dirty_tail.segment_seq == dirty_tail.segment_seq) {
       DEBUG("journal_dirty_tail {} => {}", journal_dirty_tail, dirty_tail);
     } else {
@@ -649,8 +650,15 @@ void AsyncCleaner::update_journal_tails(
     journal_dirty_tail = dirty_tail;
   }
 
-  if (journal_alloc_tail == JOURNAL_SEQ_NULL ||
-      alloc_tail > journal_alloc_tail) {
+  if (alloc_tail != JOURNAL_SEQ_NULL) {
+    ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
+                journal_head >= alloc_tail);
+    assert(alloc_tail.offset.get_addr_type() != addr_types_t::RANDOM_BLOCK);
+    if (journal_alloc_tail != JOURNAL_SEQ_NULL &&
+        journal_alloc_tail > alloc_tail) {
+      ERROR("journal_alloc_tail {} => {} is backwards!",
+            journal_alloc_tail, alloc_tail);
+    }
     if (journal_alloc_tail.segment_seq == alloc_tail.segment_seq) {
       DEBUG("journal_alloc_tail {} => {}", journal_alloc_tail, alloc_tail);
     } else {
index 9af774e908c84db950f4d4a8a8ee6f87c13d1c6c..4f6adbb540923f093f9f066404ca8730d2b1998f 100644 (file)
@@ -774,6 +774,10 @@ public:
     ceph_assert(head != JOURNAL_SEQ_NULL);
     ceph_assert(journal_head == JOURNAL_SEQ_NULL ||
                 head >= journal_head);
+    ceph_assert(journal_alloc_tail == JOURNAL_SEQ_NULL ||
+                head >= journal_alloc_tail);
+    ceph_assert(journal_dirty_tail == JOURNAL_SEQ_NULL ||
+                head >= journal_dirty_tail);
     journal_head = head;
     gc_process.maybe_wake_on_space_used();
   }
index 272c66958f671bb854f03f39ed41398d6805574d..b91acea653832ced4a40079587c262ae45f0e11b 100644 (file)
@@ -96,9 +96,6 @@ TransactionManager::mount_ertr::future<> TransactionManager::mount()
        auto modify_time)
       {
        auto start_seq = offsets.write_result.start_seq;
-       async_cleaner->update_journal_tails(
-         cache->get_oldest_dirty_from().value_or(start_seq),
-         cache->get_oldest_backref_dirty_from().value_or(start_seq));
        return cache->replay_delta(
          start_seq,
          offsets.record_block_base,