[openib-general] [PATCH] SDP doesn't flush path cache if device removed

Ralph Campbell ralphc at pathscale.com
Fri Jan 27 12:10:48 PST 2006


SDP doesn't remove cached SA path records if the device is removed.
Minor nit: flush_workqueue() doesn't need to be called before
destroy_workqueue().

Signed-off-by: Ralph Campbell <ralphc at pathscale.com>

Index: sdp_proto.h
===================================================================
--- sdp_proto.h	(revision 5193)
+++ sdp_proto.h	(working copy)
@@ -405,6 +405,8 @@
 
 void sdp_link_addr_cleanup(void);
 
+void sdp_link_device_remove_one(struct ib_device *device);
+
 /*
  * Function types
  */
Index: sdp_conn.c
===================================================================
--- sdp_conn.c	(revision 5193)
+++ sdp_conn.c	(working copy)
@@ -178,8 +178,8 @@
 	}
 
 	sdp_conn_inet_error(conn, error);
-	return;
 }
+
 /*
  * sdp_inet_accept_q_put - put a conn into a listen conn's accept Q.
  */
@@ -1861,6 +1861,8 @@
 
 	ib_destroy_cm_id(hca->listen_id);
 
+	sdp_link_device_remove_one(device);
+
 	list_for_each_entry_safe(port, tmp, &hca->port_list, list) {
 		list_del(&port->list);
 		kfree(port);
Index: sdp_link.c
===================================================================
--- sdp_link.c	(revision 5193)
+++ sdp_link.c	(working copy)
@@ -234,9 +234,9 @@
 static void sdp_path_info_destroy(struct sdp_path_info *info, int status)
 {
 	struct sdp_path_wait *wait, *tmp;
-	/* TODO: replace by list_del once we have proper locking */
-	list_del_init(&info->info_list);
 
+	list_del(&info->info_list);
+
 	list_for_each_entry_safe(wait, tmp, &info->wait_list, list)
 		sdp_path_wait_complete(wait, info, status);
 
@@ -747,6 +747,24 @@
 }
 
 /*
+ * Remove any cached path information for the given device.
+ */
+void sdp_link_device_remove_one(struct ib_device *device)
+{
+	struct sdp_path_info *info;
+
+	down(&sdp_link_mutex);
+
+	list_for_each_entry(info, &info_list, info_list)
+		if (info->ca == device) {
+			sdp_path_info_destroy(info, -ENODEV);
+			break;
+		}
+
+	up(&sdp_link_mutex);
+}
+
+/*
  * primary initialization/cleanup functions
  */
 static struct packet_type sdp_arp_type = {
@@ -829,7 +847,6 @@
 	 * destroy work queue
 	 */
 	cancel_delayed_work(&link_timer);
-	flush_workqueue(link_wq);
 	destroy_workqueue(link_wq);
 	/*
 	 * clear objects

-- 
Ralph Campbell <ralphc at pathscale.com>




More information about the general mailing list