Fix clients possibly not destroyed after being switched to RDMA

It could in theory lead to hung operations on RDMA client disconnections.

Workflow (probable):
* OSD switches an outbound connection to PEER_RDMA and removes the FD from epoll
* But a receive request in io_uring is still active
* Receive response is never handled, refs remains > 0
* The connection is dropped, but osd_client_t is not destroyed because refs > 0
* Outbound ops are not canceled, suboperations hang, primary operations hang too
This commit is contained in:
Vitaliy Filippov
2026-03-17 01:04:17 +03:00
parent fdea595913
commit 44c895dc30
4 changed files with 11 additions and 19 deletions
+6 -1
View File
@@ -9,7 +9,8 @@ void osd_messenger_t::read_requests()
{
int peer_fd = read_ready_clients[i];
auto cl_it = clients.find(peer_fd);
if (cl_it == clients.end() || !cl_it->second || cl_it->second->read_msg.msg_iovlen)
if (cl_it == clients.end() || !cl_it->second || cl_it->second->read_msg.msg_iovlen ||
cl_it->second->peer_state == PEER_RDMA || cl_it->second->peer_state == PEER_RDMA_CONNECTING)
{
continue;
}
@@ -75,6 +76,10 @@ bool osd_messenger_t::handle_read(int result, osd_client_t *cl)
int peer_fd = cl->peer_fd;
cl->read_msg.msg_iovlen = 0;
cl->refs--;
if (cl->peer_state == PEER_RDMA)
{
return true;
}
if (cl->peer_state == PEER_STOPPED)
{
if (cl->refs <= 0)