diff options
author | Andy Grover <andy.grover@oracle.com> | 2009-04-01 04:20:19 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-02 03:52:22 -0400 |
commit | 745cbccac3fe8cead529a1b3358e1e86a1505bfa (patch) | |
tree | 6c865b19881dbdd64556cc1827f6966d8a646a38 /net/rds/ib.c | |
parent | f1cffcbfcc53b825da7d1d26244aabd8dccb24aa (diff) |
RDS: Rewrite connection cleanup, fixing oops on rmmod
This fixes a bug where a connection was unexpectedly
not on *any* list while being destroyed. It also
cleans up some code duplication and regularizes some
function names.
* Grab appropriate lock in conn_free() and explain in comment
* Ensure via locking that a conn is never not on either
a dev's list or the nodev list
* Add rds_xx_remove_conn() to match rds_xx_add_conn()
* Make rds_xx_add_conn() return void
* Rename remove_{,nodev_}conns() to
destroy_{,nodev_}conns() and unify their implementation
in a helper function
* Document lock ordering as nodev conn_lock before
dev_conn_lock
Reported-by: Yosef Etigin <yosefe@voltaire.com>
Signed-off-by: Andy Grover <andy.grover@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rds/ib.c')
-rw-r--r-- | net/rds/ib.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/rds/ib.c b/net/rds/ib.c index 06a7b798d9a7..4933b380985e 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c | |||
@@ -51,6 +51,7 @@ MODULE_PARM_DESC(fmr_message_size, " Max size of a RDMA transfer"); | |||
51 | 51 | ||
52 | struct list_head rds_ib_devices; | 52 | struct list_head rds_ib_devices; |
53 | 53 | ||
54 | /* NOTE: if also grabbing ibdev lock, grab this first */ | ||
54 | DEFINE_SPINLOCK(ib_nodev_conns_lock); | 55 | DEFINE_SPINLOCK(ib_nodev_conns_lock); |
55 | LIST_HEAD(ib_nodev_conns); | 56 | LIST_HEAD(ib_nodev_conns); |
56 | 57 | ||
@@ -137,7 +138,7 @@ void rds_ib_remove_one(struct ib_device *device) | |||
137 | kfree(i_ipaddr); | 138 | kfree(i_ipaddr); |
138 | } | 139 | } |
139 | 140 | ||
140 | rds_ib_remove_conns(rds_ibdev); | 141 | rds_ib_destroy_conns(rds_ibdev); |
141 | 142 | ||
142 | if (rds_ibdev->mr_pool) | 143 | if (rds_ibdev->mr_pool) |
143 | rds_ib_destroy_mr_pool(rds_ibdev->mr_pool); | 144 | rds_ib_destroy_mr_pool(rds_ibdev->mr_pool); |
@@ -249,7 +250,7 @@ static int rds_ib_laddr_check(__be32 addr) | |||
249 | void rds_ib_exit(void) | 250 | void rds_ib_exit(void) |
250 | { | 251 | { |
251 | rds_info_deregister_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info); | 252 | rds_info_deregister_func(RDS_INFO_IB_CONNECTIONS, rds_ib_ic_info); |
252 | rds_ib_remove_nodev_conns(); | 253 | rds_ib_destroy_nodev_conns(); |
253 | ib_unregister_client(&rds_ib_client); | 254 | ib_unregister_client(&rds_ib_client); |
254 | rds_ib_sysctl_exit(); | 255 | rds_ib_sysctl_exit(); |
255 | rds_ib_recv_exit(); | 256 | rds_ib_recv_exit(); |