- struct list_head *tmp, *pos;
- struct ptlrpc_connection *c;
-
- spin_lock(&conn_lock);
-
- lustre_hash_exit(&conn_unused_hash_body);
- lustre_hash_exit(&conn_hash_body);
-
- list_for_each_safe(tmp, pos, &conn_list) {
- c = list_entry(tmp, struct ptlrpc_connection, c_link);
- if (atomic_read(&c->c_refcount))
- CERROR("Connection %p/%s has refcount %d (nid=%s)\n",
- c, c->c_remote_uuid.uuid,
- atomic_read(&c->c_refcount),
- libcfs_nid2str(c->c_peer.nid));
- list_del(&c->c_link);
- OBD_FREE(c, sizeof(*c));
- }
- spin_unlock(&conn_lock);
+ struct ptlrpc_connection *conn;
+
+ conn = hlist_entry(hnode, struct ptlrpc_connection, c_hash);
+ /*
+ * Nothing should be left. Connection user put it and
+ * connection also was deleted from table by this time
+ * so we should have 0 refs.
+ */
+ LASSERTF(atomic_read(&conn->c_refcount) == 0,
+ "Busy connection with %d refs\n",
+ atomic_read(&conn->c_refcount));
+ OBD_FREE_PTR(conn);