From: Xiubo Li Date: Wed, 26 Jul 2023 06:34:01 +0000 (+0800) Subject: mds: defer trim() until after the last cache_rejoin ack being received X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a2e314ddceeb5176d879e16fdfecda0d227e2d73;p=ceph.git mds: defer trim() until after the last cache_rejoin ack being received 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 (cherry picked from commit dd783803f44d8cc424fdf33fef0a6a9203be3447) --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 049622d808a..33a563df547 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -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) { diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 758dac6eb82..f2435e3918e 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -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;