From c94d19376ba3c80c6c3b436f2937cb871f6998fe Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 9 May 2012 13:29:51 +0000 Subject: [PATCH] --- yaml --- r: 300205 b: refs/heads/master c: c57b54684060c8aced64a5b78ff69ff289af97b9 h: refs/heads/master i: 300203: 564fd6624419321874ffaa7344e70dec2636245a v: v3 --- [refs] | 2 +- trunk/net/core/pktgen.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index c6bafe5a0e23..2a23459e3c9c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 59b9997baba5242997ddc7bd96b1391f5275a5a4 +refs/heads/master: c57b54684060c8aced64a5b78ff69ff289af97b9 diff --git a/trunk/net/core/pktgen.c b/trunk/net/core/pktgen.c index 4d8ce93cd503..77a59980b579 100644 --- a/trunk/net/core/pktgen.c +++ b/trunk/net/core/pktgen.c @@ -1931,7 +1931,7 @@ static int pktgen_device_event(struct notifier_block *unused, { struct net_device *dev = ptr; - if (!net_eq(dev_net(dev), &init_net)) + if (!net_eq(dev_net(dev), &init_net) || pktgen_exiting) return NOTIFY_DONE; /* It is OK that we do not hold the group lock right now, @@ -3755,12 +3755,18 @@ static void __exit pg_cleanup(void) { struct pktgen_thread *t; struct list_head *q, *n; + struct list_head list; /* Stop all interfaces & threads */ pktgen_exiting = true; - list_for_each_safe(q, n, &pktgen_threads) { + mutex_lock(&pktgen_thread_lock); + list_splice(&list, &pktgen_threads); + mutex_unlock(&pktgen_thread_lock); + + list_for_each_safe(q, n, &list) { t = list_entry(q, struct pktgen_thread, th_list); + list_del(&t->th_list); kthread_stop(t->tsk); kfree(t); }