Skip to content

Commit

Permalink
mds: tighten conditions of calling rejoin_gather_finish()
Browse files Browse the repository at this point in the history
Handle two cases:
1. mds receives all cache rejoin messages, then receives mdsmap that
   says mds cluster enters rejoining state.
2. when opening undef inodes/dirfrags, other mds restarts.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 0a38a49)
  • Loading branch information
ukernel authored and batrick committed May 11, 2018
1 parent 5305903 commit 6cf1525
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/mds/MDCache.cc
Expand Up @@ -4598,22 +4598,14 @@ void MDCache::handle_cache_rejoin_weak(MMDSCacheRejoin *weak)
}
} else {
// done?
if (rejoin_gather.empty()) {
if (rejoin_gather.empty() && rejoin_ack_gather.count(mds->get_nodeid())) {
rejoin_gather_finish();
} else {
dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
}
}
}

class C_MDC_RejoinGatherFinish : public MDCacheContext {
public:
explicit C_MDC_RejoinGatherFinish(MDCache *c) : MDCacheContext(c) {}
void finish(int r) override {
mdcache->rejoin_gather_finish();
}
};

/*
* rejoin_scour_survivor_replica - remove source from replica list on unmentioned objects
*
Expand Down Expand Up @@ -4972,7 +4964,7 @@ void MDCache::handle_cache_rejoin_strong(MMDSCacheRejoin *strong)
// done?
assert(rejoin_gather.count(from));
rejoin_gather.erase(from);
if (rejoin_gather.empty()) {
if (rejoin_gather.empty() && rejoin_ack_gather.count(mds->get_nodeid())) {
rejoin_gather_finish();
} else {
dout(7) << "still need rejoin from (" << rejoin_gather << ")" << dendl;
Expand Down Expand Up @@ -5315,6 +5307,7 @@ void MDCache::rejoin_gather_finish()
{
dout(10) << "rejoin_gather_finish" << dendl;
assert(mds->is_rejoin());
assert(rejoin_ack_gather.count(mds->get_nodeid()));

if (open_undef_inodes_dirfrags())
return;
Expand All @@ -5328,7 +5321,6 @@ void MDCache::rejoin_gather_finish()
rejoin_send_acks();

// signal completion of fetches, rejoin_gather_finish, etc.
assert(rejoin_ack_gather.count(mds->get_nodeid()));
rejoin_ack_gather.erase(mds->get_nodeid());

// did we already get our acks too?
Expand Down Expand Up @@ -6010,7 +6002,15 @@ bool MDCache::open_undef_inodes_dirfrags()
if (fetch_queue.empty())
return false;

MDSGatherBuilder gather(g_ceph_context, new C_MDC_RejoinGatherFinish(this));
MDSGatherBuilder gather(g_ceph_context,
new MDSInternalContextWrapper(mds,
new FunctionContext([this](int r) {
if (rejoin_gather.empty())
rejoin_gather_finish();
})
)
);

for (set<CDir*>::iterator p = fetch_queue.begin();
p != fetch_queue.end();
++p) {
Expand Down

0 comments on commit 6cf1525

Please sign in to comment.