Skip to content

Commit c4d32e7

Browse files
hiqbal-ionosrleon
authored andcommitted
RDMA/rtrs-srv: Destroy path files after making sure no IOs in-flight
Destroying path files may lead to the freeing of rdma_stats. This creates the following race. An IO is in-flight, or has just passed the session state check in process_read/process_write. The close_work gets triggered and the function rtrs_srv_close_work() starts and does destroy path which frees the rdma_stats. After this the function process_read/process_write resumes and tries to update the stats through the function rtrs_srv_update_rdma_stats This commit solves the problem by moving the destroy path function to a later point. This point makes sure any inflights are completed. This is done by qp drain, and waiting for all in-flights through ops_id. Fixes: 9cb8374 ("RDMA/rtrs: server: main functionality") Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com> Signed-off-by: Santosh Kumar Pradhan <santosh.pradhan@ionos.com> Signed-off-by: Grzegorz Prajsner <grzegorz.prajsner@ionos.com> Link: https://lore.kernel.org/r/20231120154146.920486-6-haris.iqbal@ionos.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 3a71cd6 commit c4d32e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/infiniband/ulp/rtrs/rtrs-srv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,6 @@ static void rtrs_srv_close_work(struct work_struct *work)
15321532

15331533
srv_path = container_of(work, typeof(*srv_path), close_work);
15341534

1535-
rtrs_srv_destroy_path_files(srv_path);
15361535
rtrs_srv_stop_hb(srv_path);
15371536

15381537
for (i = 0; i < srv_path->s.con_num; i++) {
@@ -1552,6 +1551,8 @@ static void rtrs_srv_close_work(struct work_struct *work)
15521551
/* Wait for all completion */
15531552
wait_for_completion(&srv_path->complete_done);
15541553

1554+
rtrs_srv_destroy_path_files(srv_path);
1555+
15551556
/* Notify upper layer if we are the last path */
15561557
rtrs_srv_path_down(srv_path);
15571558

0 commit comments

Comments
 (0)