Re: [BUG] 2.6.21 hang in cancel_rearming_delayed_workqueue()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jarek Poplawski wrote:
On 25-05-2007 05:21, Jason Wessel wrote:
There is a problem with the calling cancel_rearming_delayed_work if the timer was not yet active.


It is possible that the problem exists else where, but I thought I would ask if this is expected?



" * cancel_rearming_delayed_workqueue - reliably kill off a delayed
 work whose handler rearms the delayed work."

So, it cannot be used in netpoll_cleanup() if there is no rearming
during this cancel at all. This is a tricky behaviour of course,
and is changed in 2.6.22-rc.


I had read that as well. It seems this the API for the cancel is restricted such that you cannot call it if there is nothing to cancel.

This means the netpoll code is incorrect and the simple fix is attached. With the change the netpoll_cleanup works correctly in 2.6.21.

Thanks,
Jason.
Do not call cancel_rearming_delayed_work() if there is no
pending work.

Signed-off-by: Jason Wessel <[email protected]>

---
 net/core/netpoll.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.21/net/core/netpoll.c
===================================================================
--- linux-2.6.21.orig/net/core/netpoll.c
+++ linux-2.6.21/net/core/netpoll.c
@@ -781,8 +781,10 @@ void netpoll_cleanup(struct netpoll *np)
 			if (atomic_dec_and_test(&npinfo->refcnt)) {
 				skb_queue_purge(&npinfo->arp_tx);
 				skb_queue_purge(&npinfo->txq);
-				cancel_rearming_delayed_work(&npinfo->tx_work);
-				flush_scheduled_work();
+				if (delayed_work_pending(&npinfo->tx_work)) {
+					cancel_rearming_delayed_work(&npinfo->tx_work);
+					flush_scheduled_work();
+				}
 
 				kfree(npinfo);
 			}

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux