Skip to content

Commit ac26868

Browse files
Merge pull request ceph#52648 from lxbsz/wip-62036
mds: defer trim() until after the last cache_rejoin ack being received Reviewed-by: Patrick Donnelly <[email protected]> Reviewed-by: Rishabh Dave <[email protected]>
2 parents 64c99bf + dd78380 commit ac26868

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/mds/MDCache.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13919,6 +13919,13 @@ void MDCache::handle_mdsmap(const MDSMap &mdsmap, const MDSMap &oldmap) {
1391913919
}
1392013920
}
1392113921

13922+
bool MDCache::is_ready_to_trim_cache(void)
13923+
{
13924+
// null rejoin_done means rejoin has finished and all the rejoin acks
13925+
// have been well received.
13926+
return is_open() && !rejoin_done;
13927+
}
13928+
1392213929
void MDCache::upkeep_main(void)
1392313930
{
1392413931
std::unique_lock lock(upkeep_mutex);
@@ -13939,7 +13946,7 @@ void MDCache::upkeep_main(void)
1393913946
if (active_with_clients) {
1394013947
trim_client_leases();
1394113948
}
13942-
if (is_open() || mds->is_standby_replay()) {
13949+
if (is_ready_to_trim_cache() || mds->is_standby_replay()) {
1394313950
trim();
1394413951
}
1394513952
if (active_with_clients) {

src/mds/MDCache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,8 @@ class MDCache {
14731473

14741474
void upkeep_main(void);
14751475

1476+
bool is_ready_to_trim_cache(void);
1477+
14761478
uint64_t cache_memory_limit;
14771479
double cache_reservation;
14781480
double cache_health_threshold;

0 commit comments

Comments
 (0)