Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions src/mds/MDCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9816,25 +9816,7 @@ void MDCache::request_forward(const MDRequestRef& mdr, mds_rank_t who, int port)
void MDCache::dispatch_request(const MDRequestRef& mdr)
{
if (mdr->dead) {
dout(10) << __func__ << ": dead " << *mdr << dendl;
//if the mdr is a "batch_op" and it has followers, pick a follower as
//the new "head of the batch ops" and go on processing the new one.
if (mdr->client_request && mdr->is_batch_head()) {
int mask = mdr->client_request->head.args.getattr.mask;
auto it = mdr->batch_op_map->find(mask);
auto new_batch_head = it->second->find_new_head();
if (!new_batch_head) {
mdr->batch_op_map->erase(it);
dout(10) << __func__ << ": mask '" << mask
<< "' batch head is dead and there is no follower" << dendl;
return;
}
dout(10) << __func__ << ": mask '" << mask
<< "' batch head is dead and queue a new one "
<< *new_batch_head << dendl;
mds->finisher->queue(new C_MDS_RetryRequest(this, new_batch_head));
return;
}
dout(20) << __func__ << ": dead " << *mdr << dendl;
return;
}
if (mdr->client_request) {
Expand Down Expand Up @@ -9958,6 +9940,19 @@ void MDCache::request_cleanup(const MDRequestRef& mdr)

mdr->dead = true;

if (mdr->killed && mdr->client_request && mdr->is_batch_head()) {
dout(10) << "request " << *mdr << " was killed and dead" << dendl;
//if the mdr is a "batch_op" and it has followers, pick a follower as
//the new "head of the batch ops" and go on processing the new one.
int mask = mdr->client_request->head.args.getattr.mask;
auto it = mdr->batch_op_map->find(mask);
auto new_batch_head = it->second->find_new_head();
if (!new_batch_head) {
mdr->batch_op_map->erase(it);
}
mds->finisher->queue(new C_MDS_RetryRequest(this, new_batch_head));
}

if (mdr->has_more()) {
if (mdr->more()->is_ambiguous_auth)
mdr->clear_ambiguous_auth();
Expand Down
24 changes: 3 additions & 21 deletions src/mds/Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2644,27 +2644,9 @@ void Server::dispatch_client_request(const MDRequestRef& mdr)
ceph_assert(!mdr->has_more() || mdr->more()->waiting_on_peer.empty());

if (mdr->killed) {
dout(10) << "request " << *mdr << " was killed" << dendl;
//if the mdr is a "batch_op" and it has followers, pick a follower as
//the new "head of the batch ops" and go on processing the new one.
if (mdr->is_batch_head()) {
int mask = mdr->client_request->head.args.getattr.mask;
auto it = mdr->batch_op_map->find(mask);
auto new_batch_head = it->second->find_new_head();
if (!new_batch_head) {
mdr->batch_op_map->erase(it);
dout(10) << __func__ << ": mask '" << mask
<< "' batch head is killed and there is no follower" << dendl;
return;
}
dout(10) << __func__ << ": mask '" << mask
<< "' batch head is killed and queue a new one "
<< *new_batch_head << dendl;
mds->finisher->queue(new C_MDS_RetryRequest(mdcache, new_batch_head));
return;
} else {
return;
}
// Should already be reset in request_cleanup().
ceph_assert(!mdr->is_batch_head());
return;
} else if (mdr->aborted) {
mdr->aborted = false;
mdcache->request_kill(mdr);
Expand Down