Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msg/async/rdma: fix outstanding queuepair when destruct RDMAStack #13905

Merged
merged 2 commits into from Mar 16, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/msg/async/rdma/RDMAStack.cc
Expand Up @@ -36,6 +36,7 @@ RDMADispatcher::~RDMADispatcher()
ldout(cct, 20) << __func__ << " destructing rdma dispatcher" << dendl;

assert(qp_conns.empty());
assert(num_qp_conn == 0);
assert(dead_queue_pairs.empty());
assert(num_dead_queue_pair == 0);

Expand Down Expand Up @@ -213,7 +214,7 @@ void RDMADispatcher::polling()
--num_dead_queue_pair;
}
}
if (done)
if (!num_qp_conn && done)
break;

if ((ceph_clock_now() - last_inactive).to_nsec() / 1000 > cct->_conf->ms_async_rdma_polling_us) {
Expand All @@ -237,7 +238,7 @@ void RDMADispatcher::polling()
r = 0;
perf_logger->set(l_msgr_rdma_polling, 0);
while (!done && r == 0) {
r = poll(channel_poll, 2, 1);
r = poll(channel_poll, 2, 100);
if (r < 0) {
r = -errno;
lderr(cct) << __func__ << " poll failed " << r << dendl;
Expand Down Expand Up @@ -279,6 +280,7 @@ int RDMADispatcher::register_qp(QueuePair *qp, RDMAConnectedSocketImpl* csi)
Mutex::Locker l(lock);
assert(!qp_conns.count(qp->get_local_qp_number()));
qp_conns[qp->get_local_qp_number()] = std::make_pair(qp, csi);
++num_qp_conn;
return fd;
}

Expand All @@ -301,6 +303,7 @@ void RDMADispatcher::erase_qpn(uint32_t qpn)
++num_dead_queue_pair;
dead_queue_pairs.push_back(it->second.first);
qp_conns.erase(it);
--num_qp_conn;
}

void RDMADispatcher::handle_pre_fork()
Expand Down
1 change: 1 addition & 0 deletions src/msg/async/rdma/RDMAStack.h
Expand Up @@ -73,6 +73,7 @@ class RDMADispatcher : public CephContext::ForkWatcher {
EventCallbackRef async_handler;
bool done = false;
std::atomic<uint64_t> num_dead_queue_pair = {0};
std::atomic<uint64_t> num_qp_conn = {0};
Mutex lock; // protect `qp_conns`, `dead_queue_pairs`
// qp_num -> InfRcConnection
// The main usage of `qp_conns` is looking up connection by qp_num,
Expand Down