]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - net/rds/connection.c
fib_hash: RCU conversion phase 2
[mv-sheeva.git] / net / rds / connection.c
index 968b7a798398fce90eeb2d8b2d2b1073770a5950..870992e08cae2e86681d569b3ac27d83b6dffb89 100644 (file)
@@ -312,6 +312,10 @@ void rds_conn_shutdown(struct rds_connection *conn)
 
 /*
  * Stop and free a connection.
+ *
+ * This can only be used in very limited circumstances.  It assumes that once
+ * the conn has been shutdown that no one else is referencing the connection.
+ * We can only ensure this in the rmmod path in the current code.
  */
 void rds_conn_destroy(struct rds_connection *conn)
 {
@@ -326,10 +330,15 @@ void rds_conn_destroy(struct rds_connection *conn)
        spin_lock_irq(&rds_conn_lock);
        hlist_del_init_rcu(&conn->c_hash_node);
        spin_unlock_irq(&rds_conn_lock);
-
        synchronize_rcu();
 
-       rds_conn_shutdown(conn);
+       /* shut the connection down */
+       rds_conn_drop(conn);
+       flush_work(&conn->c_down_w);
+
+       /* make sure lingering queued work won't try to ref the conn */
+       cancel_delayed_work_sync(&conn->c_send_w);
+       cancel_delayed_work_sync(&conn->c_recv_w);
 
        /* tear down queued messages */
        list_for_each_entry_safe(rm, rtmp,