]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/rds: Don't sleep inside rds_ib_conn_path_shutdown
authorAllison Henderson <achender@kernel.org>
Mon, 18 May 2026 01:24:33 +0000 (18:24 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 May 2026 00:03:02 +0000 (17:03 -0700)
New rds rdma self tests exposed a hang when tearing down
the ib network configs.  This is caused by the shutdown worker
thread sleeping on the wait_event call, which blocks other work
items in the queue. Fix this by changing wait_event to
wait_event timeout, and looping until the wait check succeeds.

Signed-off-by: Allison Henderson <achender@kernel.org>
Link: https://patch.msgid.link/20260518012443.2629206-2-achender@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/rds/ib_cm.c

index 0c64c504f79db5dfb72d719a04464093d614cefd..6b40345ba44d12759b4ce5917ac62c954817ce6a 100644 (file)
@@ -1038,6 +1038,19 @@ out:
        return ret;
 }
 
+static unsigned long rds_ib_conn_path_shutdown_check_wait(struct rds_conn_path *cp)
+{
+       struct rds_connection *conn = cp->cp_conn;
+       struct rds_ib_connection *ic = conn->c_transport_data;
+
+       return (!ic->i_cm_id ||
+               (rds_ib_ring_empty(&ic->i_recv_ring) &&
+                (atomic_read(&ic->i_signaled_sends) == 0) &&
+                (atomic_read(&ic->i_fastreg_inuse_count)) == 0 &&
+                (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR))) ? 0
+               : msecs_to_jiffies(1000);
+}
+
 /*
  * This is so careful about only cleaning up resources that were built up
  * so that it can be called at any point during startup.  In fact it
@@ -1078,11 +1091,13 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
                 * sends to complete we're ensured that there will be no
                 * more tx processing.
                 */
-               wait_event(rds_ib_ring_empty_wait,
-                          rds_ib_ring_empty(&ic->i_recv_ring) &&
-                          (atomic_read(&ic->i_signaled_sends) == 0) &&
-                          (atomic_read(&ic->i_fastreg_inuse_count) == 0) &&
-                          (atomic_read(&ic->i_fastreg_wrs) == RDS_IB_DEFAULT_FR_WR));
+               while (!wait_event_timeout(rds_ib_ring_empty_wait,
+                                          rds_ib_conn_path_shutdown_check_wait(cp) == 0,
+                                          msecs_to_jiffies(1000))) {
+                       tasklet_schedule(&ic->i_send_tasklet);
+                       tasklet_schedule(&ic->i_recv_tasklet);
+               }
+
                tasklet_kill(&ic->i_send_tasklet);
                tasklet_kill(&ic->i_recv_tasklet);