[PATCH 3/3] ehea: fix race condition

Previous thread: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte by Christoph Lameter on Thursday, July 3, 2008 - 7:14 am. (5 messages)

Next thread: [PATCH 2/3] ehea: add MODULE_DEVICE_TABLE by Jan-Bernd Themann on Thursday, July 3, 2008 - 7:18 am. (1 message)
From: Jan-Bernd Themann
Date: Thursday, July 3, 2008 - 7:18 am

When ehea_stop is called the function 
cancel_work_sync(&port->reset_task) is used to ensure
that the reset task is not running anymore. We need an 
additional flag to ensure that it can not be scheduled
after this call again for a certain time.


Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>

---

diff -Nurp -X dontdiff linux-2.6.26-rc8/drivers/net/ehea/ehea.h patched_kernel/drivers/net/ehea/ehea.h
--- linux-2.6.26-rc8/drivers/net/ehea/ehea.h	2008-07-02 16:52:13.000000000 +0200
+++ patched_kernel/drivers/net/ehea/ehea.h	2008-07-02 17:01:39.000000000 +0200
@@ -40,7 +40,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME	"ehea"
-#define DRV_VERSION	"EHEA_0091"
+#define DRV_VERSION	"EHEA_0092"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
@@ -478,6 +478,7 @@ struct ehea_port {
 	int num_add_tx_qps;
 	int num_mcs;
 	int resets;
+	u64 flags;
 	u64 mac_addr;
 	u32 logical_port_id;
 	u32 port_speed;
@@ -501,7 +502,8 @@ struct port_res_cfg {
 };
 
 enum ehea_flag_bits {
-	__EHEA_STOP_XFER
+	__EHEA_STOP_XFER,
+	__EHEA_DISABLE_PORT_RESET
 };
 
 void ehea_set_ethtool_ops(struct net_device *netdev);
diff -Nurp -X dontdiff linux-2.6.26-rc8/drivers/net/ehea/ehea_main.c patched_kernel/drivers/net/ehea/ehea_main.c
--- linux-2.6.26-rc8/drivers/net/ehea/ehea_main.c	2008-07-02 17:01:18.000000000 +0200
+++ patched_kernel/drivers/net/ehea/ehea_main.c	2008-07-02 17:01:39.000000000 +0200
@@ -138,6 +138,12 @@ void ehea_dump(void *adr, int len, char 
 	}
 }
 
+void ehea_schedule_port_reset(struct ehea_port *port)
+{
+	if (!test_bit(__EHEA_DISABLE_PORT_RESET, &port->flags))
+		schedule_work(&port->reset_task);
+}
+
 static void ehea_update_firmware_handles(void)
 {
 	struct ehea_fw_handle_entry *arr = NULL;
@@ -588,7 +594,7 @@ static int ehea_treat_poll_error(struct 
 				   "Resetting port.", pr->qp->init_attr.qp_nr);
 			ehea_dump(cqe, sizeof(*cqe), "CQE");
 		}
-		schedule_work(&pr->port->reset_task);
+		ehea_schedule_port_reset(pr->port);
 		return ...
Previous thread: slub: Do not use 192 byte sized cache if minimum alignment is 128 byte by Christoph Lameter on Thursday, July 3, 2008 - 7:14 am. (5 messages)

Next thread: [PATCH 2/3] ehea: add MODULE_DEVICE_TABLE by Jan-Bernd Themann on Thursday, July 3, 2008 - 7:18 am. (1 message)