|
@@ -3065,7 +3065,13 @@ static int pktgen_wait_thread_run(struct pktgen_thread *t)
|
|
|
{
|
|
{
|
|
|
while (thread_is_running(t)) {
|
|
while (thread_is_running(t)) {
|
|
|
|
|
|
|
|
|
|
+ /* note: 't' will still be around even after the unlock/lock
|
|
|
|
|
+ * cycle because pktgen_thread threads are only cleared at
|
|
|
|
|
+ * net exit
|
|
|
|
|
+ */
|
|
|
|
|
+ mutex_unlock(&pktgen_thread_lock);
|
|
|
msleep_interruptible(100);
|
|
msleep_interruptible(100);
|
|
|
|
|
+ mutex_lock(&pktgen_thread_lock);
|
|
|
|
|
|
|
|
if (signal_pending(current))
|
|
if (signal_pending(current))
|
|
|
goto signal;
|
|
goto signal;
|
|
@@ -3080,6 +3086,10 @@ static int pktgen_wait_all_threads_run(struct pktgen_net *pn)
|
|
|
struct pktgen_thread *t;
|
|
struct pktgen_thread *t;
|
|
|
int sig = 1;
|
|
int sig = 1;
|
|
|
|
|
|
|
|
|
|
+ /* prevent from racing with rmmod */
|
|
|
|
|
+ if (!try_module_get(THIS_MODULE))
|
|
|
|
|
+ return sig;
|
|
|
|
|
+
|
|
|
mutex_lock(&pktgen_thread_lock);
|
|
mutex_lock(&pktgen_thread_lock);
|
|
|
|
|
|
|
|
list_for_each_entry(t, &pn->pktgen_threads, th_list) {
|
|
list_for_each_entry(t, &pn->pktgen_threads, th_list) {
|
|
@@ -3093,6 +3103,7 @@ static int pktgen_wait_all_threads_run(struct pktgen_net *pn)
|
|
|
t->control |= (T_STOP);
|
|
t->control |= (T_STOP);
|
|
|
|
|
|
|
|
mutex_unlock(&pktgen_thread_lock);
|
|
mutex_unlock(&pktgen_thread_lock);
|
|
|
|
|
+ module_put(THIS_MODULE);
|
|
|
return sig;
|
|
return sig;
|
|
|
}
|
|
}
|
|
|
|
|
|