rpc: fix apple rdma error spew on teardown (#27908)

This commit is contained in:
Ryan C 2026-08-30 06:16:26 +00:00 committed by GitHub
parent 093adb242e
commit 742347b2e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,16 +115,9 @@ struct apple_rdma::impl {
~impl() {
broken = true;
// the QP must be destroyed before the memory it can still write to is
// deregistered and freed: ERR only starts flushing the posted WQEs
if (qp) {
struct ibv_qp_attr a = {};
a.qp_state = IBV_QPS_ERR;
ibv_modify_qp(qp, &a, IBV_QP_STATE);
struct ibv_wc wc[RDMA_NBUF * 2];
while (ibv_poll_cq(cq, RDMA_NBUF * 2, wc) > 0) {}
ibv_destroy_qp(qp);
}
// destroy the QP first: it can still write to the rings until it is gone.
// no IBV_QPS_ERR before it - Apple's provider then fails every region unmap.
if (qp) ibv_destroy_qp(qp);
if (send_mr) ibv_dereg_mr(send_mr);
if (recv_mr) ibv_dereg_mr(recv_mr);
free(send_mem);