[rds-devel] [PATCH 3/3] [rds] disconnect when IB devices are removed

Zach Brown zach.brown at oracle.com
Wed Apr 21 15:14:36 PDT 2010


Currently IB device removal destroys connections which are associated with the
device.  This prevents connections from being re-established when replacement
devices are added.

Instead we'll queue shutdown work on the connections as their devices are
removed.  When we see that devices are added we triger connection attempts on
all connections that don't currently have a device.

The result is that RDS sockets can resume device-independent work (bcopy, not
RDMA) across IB device removal and restoration.

Signed-off-by: Zach Brown <zach.brown at oracle.com>
---
 net/rds/ib.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/net/rds/ib.c b/net/rds/ib.c
index fcf52bd..f6da454 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -58,6 +58,27 @@ struct list_head rds_ib_devices;
 DEFINE_SPINLOCK(ib_nodev_conns_lock);
 LIST_HEAD(ib_nodev_conns);
 
+void rds_ib_nodev_connect(void)
+{
+	struct rds_ib_connection *ic;
+
+	spin_lock(&ib_nodev_conns_lock);
+	list_for_each_entry(ic, &ib_nodev_conns, ib_node)
+		rds_conn_connect_if_down(ic->conn);
+	spin_unlock(&ib_nodev_conns_lock);
+}
+
+void rds_ib_dev_shutdown(struct rds_ib_device *rds_ibdev)
+{
+	struct rds_ib_connection *ic;
+	unsigned long flags;
+
+	spin_lock_irqsave(&rds_ibdev->spinlock, flags);
+	list_for_each_entry(ic, &rds_ibdev->conn_list, ib_node)
+		rds_conn_drop(ic->conn);
+	spin_unlock_irqrestore(&rds_ibdev->spinlock, flags);
+}
+
 /* 
  * rds_ib_destroy_mr_pool() blocks on a few things and mrs drop references
  * from interrupt context so we push freing off into a work struct in krdsd.
@@ -152,6 +173,8 @@ void rds_ib_add_one(struct ib_device *device)
 	ib_set_client_data(device, &rds_ib_client, rds_ibdev);
 	atomic_inc(&rds_ibdev->refcount);
 
+	rds_ib_nodev_connect();
+
 put_dev:
 	rds_ib_dev_put(rds_ibdev);
 free_attr:
@@ -200,7 +223,7 @@ void rds_ib_remove_one(struct ib_device *device)
 
 	rds_ibdev = ib_get_client_data(device, &rds_ib_client);
 	if (rds_ibdev) {
-		rds_ib_destroy_conns(rds_ibdev);
+		rds_ib_dev_shutdown(rds_ibdev);
 
 		/* 
 		 * stop new connections from seeing this client and
-- 
1.6.2.5




More information about the rds-devel mailing list