]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: defer trim() until after the last cache_rejoin ack being received 52648/head
authorXiubo Li <xiubli@redhat.com>
Wed, 26 Jul 2023 06:34:01 +0000 (14:34 +0800)
committerXiubo Li <xiubli@redhat.com>
Fri, 2 Feb 2024 07:54:19 +0000 (15:54 +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>
src/mds/MDCache.cc
src/mds/MDCache.h

index 325da1ae4c973558107232e9766e2d9f46cb6a08..6e27a1d20c509831a6a96d8ad71e2e78634882a1 100644 (file)
@@ -13470,6 +13470,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);
@@ -13490,7 +13497,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 94347b8249cc361514b3187a95ac7c3209f443ef..ab76d24406507b66a137da6aa0a07b54371f9bf6 100644 (file)
@@ -1368,6 +1368,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;