]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: defer trim() until after the last cache_rejoin ack being received 56748/head
authorXiubo Li <xiubli@redhat.com>
Wed, 26 Jul 2023 06:34:01 +0000 (14:34 +0800)
committerXiubo Li <xiubli@redhat.com>
Mon, 8 Apr 2024 02:26:09 +0000 (10:26 +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 049622d808a7b1e9330f8ac37a2771290f4fd85f..33a563df5478ea096144cc62034e1f7ddff37e09 100644 (file)
@@ -13378,6 +13378,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);
@@ -13398,7 +13405,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 758dac6eb82e51d8a63257174845f3f704b49a28..f2435e3918e3a3024a7a223f1c2062a6a10951d4 100644 (file)
@@ -1336,6 +1336,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;