Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxgb3: fix workqueue flush issues

The fatal error task can be scheduled while processing an offload packet
in NAPI context when the connection handle is bogus. this can race
with the ports being brought down and the cxgb3 workqueue being flushed.
Stop napi processing before flushing the work queue.

The ULP drivers (iSCSI, iWARP) might also schedule a task on keventd_wk
while releasing a connection handle (cxgb3_offload.c::cxgb3_queue_tid_release()).
The driver however does not flush any work on keventd_wq while being unloaded.
This patch also fixes this.

Also call cancel_delayed_work_sync in place of the the deprecated
cancel_rearming_delayed_workqueue.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Divy Le Ray and committed by
David S. Miller
c80b0c28 3851c66c

+5 -3
+5 -3
drivers/net/cxgb3/cxgb3_main.c
··· 1117 1117 spin_unlock_irq(&adapter->work_lock); 1118 1118 1119 1119 free_irq_resources(adapter); 1120 - flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ 1121 1120 quiesce_rx(adapter); 1121 + flush_workqueue(cxgb3_wq); /* wait for external IRQ handler */ 1122 1122 } 1123 1123 1124 1124 static void schedule_chk_task(struct adapter *adap) ··· 1187 1187 1188 1188 sysfs_remove_group(&tdev->lldev->dev.kobj, &offload_attr_group); 1189 1189 1190 + /* Flush work scheduled while releasing TIDs */ 1191 + flush_scheduled_work(); 1192 + 1190 1193 tdev->lldev = NULL; 1191 1194 cxgb3_set_dummy_ops(tdev); 1192 1195 t3_tp_set_offload_mode(adapter, 0); ··· 1250 1247 spin_unlock_irq(&adapter->work_lock); 1251 1248 1252 1249 if (!(adapter->open_device_map & PORT_MASK)) 1253 - cancel_rearming_delayed_workqueue(cxgb3_wq, 1254 - &adapter->adap_check_task); 1250 + cancel_delayed_work_sync(&adapter->adap_check_task); 1255 1251 1256 1252 if (!adapter->open_device_map) 1257 1253 cxgb_down(adapter);