Skip to content

Commit

Permalink
mds: don't purge strays when mds is in clientreplay state
Browse files Browse the repository at this point in the history
MDS does not trim log when it's in clientreplay state. If mds hang
at clientreplay state (due to bug), purging strays can submit lots
of log events and create very large mds log.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
  • Loading branch information
ukernel committed Jan 25, 2017
1 parent afe889c commit 86bbc7f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/mds/MDCache.h
Expand Up @@ -146,6 +146,10 @@ class MDCache {
stray_index = (stray_index+1)%NUM_STRAY;
}

void activate_stray_manager() {
stray_manager.activate();
}

/**
* Call this when you know that a CDentry is ready to be passed
* on to StrayManager (i.e. this is a stray you've just created)
Expand Down
1 change: 1 addition & 0 deletions src/mds/MDSRank.cc
Expand Up @@ -1285,6 +1285,7 @@ void MDSRank::active_start()
mdcache->start_files_to_recover();

mdcache->reissue_all_caps();
mdcache->activate_stray_manager();

finish_contexts(g_ceph_context, waiting_for_active); // kick waiters
}
Expand Down
14 changes: 13 additions & 1 deletion src/mds/StrayManager.cc
Expand Up @@ -433,6 +433,11 @@ bool StrayManager::_consume(CDentry *dn, bool trunc, uint32_t ops_required)
{
const int files_avail = g_conf->mds_max_purge_files - files_purging;

if (!started) {
dout(20) << __func__ << ": haven't started purging yet" << dendl;
return false;
}

if (files_avail <= 0) {
dout(20) << __func__ << ": throttling on max files" << dendl;
return false;
Expand Down Expand Up @@ -732,6 +737,13 @@ bool StrayManager::__eval_stray(CDentry *dn, bool delay)
}
}

void StrayManager::activate()
{
dout(10) << __func__ << dendl;
started = true;
_advance();
}

bool StrayManager::eval_stray(CDentry *dn, bool delay)
{
// avoid nested eval_stray
Expand Down Expand Up @@ -838,7 +850,7 @@ void StrayManager::migrate_stray(CDentry *dn, mds_rank_t to)

StrayManager::StrayManager(MDSRank *mds)
: delayed_eval_stray(member_offset(CDentry, item_stray)),
mds(mds), logger(NULL),
mds(mds), logger(NULL), started(false),
ops_in_flight(0), files_purging(0),
max_purge_ops(0),
num_strays(0), num_strays_purging(0), num_strays_delayed(0),
Expand Down
3 changes: 3 additions & 0 deletions src/mds/StrayManager.h
Expand Up @@ -55,6 +55,8 @@ class StrayManager
MDSRank *mds;
PerfCounters *logger;

bool started;

// Throttled allowances
uint64_t ops_in_flight;
uint64_t files_purging;
Expand Down Expand Up @@ -168,6 +170,7 @@ class StrayManager
public:
explicit StrayManager(MDSRank *mds);
void set_logger(PerfCounters *l) {logger = l;}
void activate();

bool eval_stray(CDentry *dn, bool delay=false);

Expand Down

0 comments on commit 86bbc7f

Please sign in to comment.