]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: defer trim() until after the last cache_rejoin ack being received 56747/head
authorXiubo Li <xiubli@redhat.com>
Wed, 26 Jul 2023 06:34:01 +0000 (14:34 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 18 Jun 2024 04:14:52 +0000 (12:14 +0800)
Just before the last cache_rejoin ack being received the entire
subtree, together with the inode subtree root belongs to, were
trimmed the isolated_inodes list couldn't be correctly erased. We
should defer calling the trim() until the last cache_rejoin ack
being received.

Fixes: https://tracker.ceph.com/issues/62036
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit dd783803f44d8cc424fdf33fef0a6a9203be3447)

src/mds/MDCache.cc
src/mds/MDCache.h

index 5480e6dcd5efef830b20d250c2817834b90c014f..b892908d733319a0f17fb389f25c43b323a538d7 100644 (file)
@@ -13483,6 +13483,13 @@ void MDCache::handle_mdsmap(const MDSMap &mdsmap, const MDSMap &oldmap) {
   }
 }
 
+bool MDCache::is_ready_to_trim_cache(void)
+{
+  // null rejoin_done means rejoin has finished and all the rejoin acks
+  // have been well received.
+  return is_open() && !rejoin_done;
+}
+
 void MDCache::upkeep_main(void)
 {
   std::unique_lock lock(upkeep_mutex);
@@ -13503,7 +13510,7 @@ void MDCache::upkeep_main(void)
         if (active_with_clients) {
           trim_client_leases();
         }
-        if (is_open() || mds->is_standby_replay()) {
+        if (is_ready_to_trim_cache() || mds->is_standby_replay()) {
           trim();
         }
         if (active_with_clients) {
index f1b58c28d111b9f98524a4f024ebaaded9a63f8b..f65cfc3beac9f6733a2116ae034d4931e7772a4c 100644 (file)
@@ -1351,6 +1351,8 @@ class MDCache {
 
   void upkeep_main(void);
 
+  bool is_ready_to_trim_cache(void);
+
   uint64_t cache_memory_limit;
   double cache_reservation;
   double cache_health_threshold;