Skip to content

Commit 6c84b81

Browse files
kcp-gitSomasundaram Krishnasamy
authored andcommitted
net/rds: rds_ib_remove_one() needs to wait
The RDMA device removal upcall (for RDS, it is rds_ib_remove_one()) expects that all resources related to the device should be cleaned up before the upcall returns. After the upcall returns, it will proceed to clean up the device related resources. This means that rds_ib_remove_one() has to wait for all the related RDS resources to be cleaned up before returning. Orabug: 31794611 Signed-off-by: Ka-Cheong Poon <[email protected]> Tested-by: Suhua Ding <[email protected]> Tested-by: Jenny Xu <[email protected]> Reviewed-by: Håkon Bugge <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 7c678b8 commit 6c84b81

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

net/rds/ib.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ static void rds_ib_dev_free(struct work_struct *work)
426426
if (rds_ibdev->vector_load)
427427
kfree(rds_ibdev->vector_load);
428428

429+
complete(rds_ibdev->rid_dev_rem_complete);
429430
kfree(rds_ibdev);
430431
}
431432

@@ -473,6 +474,7 @@ struct rds_ib_device *rds_ib_get_client_data(struct ib_device *device)
473474
*/
474475
void rds_ib_remove_one(struct ib_device *device, void *client_data)
475476
{
477+
DECLARE_COMPLETION(rem_complete);
476478
struct rds_ib_device *rds_ibdev;
477479

478480
rds_rtd(RDS_RTD_RDMA_IB, "Removing ib_device: %p name: %s num_ports: %u\n",
@@ -499,6 +501,8 @@ void rds_ib_remove_one(struct ib_device *device, void *client_data)
499501
list_del_rcu(&rds_ibdev->list);
500502
up_write(&rds_ib_devices_lock);
501503

504+
rds_ibdev->rid_dev_rem_complete = &rem_complete;
505+
502506
/*
503507
* This synchronize rcu is waiting for readers of both the ib
504508
* client data and the devices list to finish before we drop
@@ -507,6 +511,7 @@ void rds_ib_remove_one(struct ib_device *device, void *client_data)
507511
synchronize_rcu();
508512
rds_ib_dev_put(rds_ibdev);
509513
rds_ib_dev_put(rds_ibdev);
514+
wait_for_completion(&rem_complete);
510515
}
511516

512517
struct ib_client rds_ib_client = {

net/rds/ib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ struct rds_ib_device {
385385
struct rds_ib_refill_cache i_cache_incs;
386386
struct rds_ib_refill_cache i_cache_frags[RDS_FRAG_CACHE_ENTRIES];
387387
struct dentry *debugfs_dir;
388+
389+
struct completion *rid_dev_rem_complete;
388390
};
389391

390392
static inline int ibdev_to_node(struct ib_device *ibdev)

0 commit comments

Comments
 (0)