[rds-devel] [PATCH 1/2] RDS/IB: Handle connection request in case of failover.

Vladimir Sokolovsky vlad at mellanox.co.il
Wed Jun 6 08:18:25 PDT 2007


Hi Zach,
Please review the following two patches:

RDS/IB: Handle connection request in case of failover.

Signed-off-by: Vladimir Sokolovsky <vlad at mellanox.co.il>
---

diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 0953b85..7d88ab9 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -237,6 +237,30 @@ static int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
        ic = conn->c_transport_data;

        /*
+        * the connection request may occur while the
+        * previous connection exist. E.g. in case of failover
+        */
+
+       if (ic->i_cm_id) {
+               ic->i_wc_err = 1;
+               printk(KERN_WARNING "RDS/IB: connection request while the connection exist: "
+                                       "%u.%u.%u.%u, disconnecting and reconnecting "
+                                       "ic %p ic->i_cm_id %p\n", NIPQUAD(conn->c_faddr), ic, ic->i_cm_id);
+               queue_work(rds_wq, &conn->c_down_w);
+               ret = -1;
+               goto out;
+       }
+       if (cm_id->context) {
+               ic->i_wc_err = 1;
+               printk(KERN_WARNING "RDS/IB: connection request while the connection exist: "
+                                       "%u.%u.%u.%u, disconnecting and reconnecting "
+                                       "cm_id %p cm_id->context %p\n", NIPQUAD(conn->c_faddr), cm_id, cm_id->context);
+               queue_work(rds_wq, &conn->c_down_w);
+               ret = -1;
+               goto out;
+       }
+
+       /*
         * see the comment above rds_queue_delayed_reconnect()
         */
        if (test_and_set_bit(RDS_CONN_CONNECTING, &conn->c_status)) {
@@ -247,10 +271,7 @@ static int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id,
                queue_work(rds_wq, &conn->c_down_w);
                ret = 0;
                goto out;
-       }
-
-       BUG_ON(ic->i_cm_id);
-       BUG_ON(cm_id->context);
+        }

        ic->i_cm_id = cm_id;
        cm_id->context = conn;

-- 
Vladimir Sokolovsky <vlad at mellanox.co.il>
Mellanox Technologies Ltd.



More information about the rds-devel mailing list