- char str[PTL_NALFMT_SIZE];
- struct list_head *tmp, *pos;
- struct ptlrpc_connection *c;
-
- spin_lock(&conn_lock);
- list_for_each_safe(tmp, pos, &conn_unused_list) {
- c = list_entry(tmp, struct ptlrpc_connection, c_link);
- list_del(&c->c_link);
- OBD_FREE(c, sizeof(*c));
- }
- list_for_each_safe(tmp, pos, &conn_list) {
- c = list_entry(tmp, struct ptlrpc_connection, c_link);
- CERROR("Connection %p/%s has refcount %d (nid=%s on %s)\n",
- c, c->c_remote_uuid.uuid, atomic_read(&c->c_refcount),
- ptlrpc_peernid2str(&c->c_peer, str),
- c->c_peer.peer_ni->pni_name);
- list_del(&c->c_link);
- OBD_FREE(c, sizeof(*c));
- }
- spin_unlock(&conn_lock);
+ struct ptlrpc_connection *conn;
+
+ conn = cfs_hlist_entry(hnode, struct ptlrpc_connection, c_hash);
+ cfs_atomic_dec(&conn->c_refcount);