From: Jason Wessel <jason.wessel@windriver.com>
To: Jarek Poplawski <jarkao2@o2.pl>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [BUG] 2.6.21 hang in cancel_rearming_delayed_workqueue()
Date: Fri, 25 May 2007 08:21:23 -0500 [thread overview]
Message-ID: <4656E2D3.4050106@windriver.com> (raw)
In-Reply-To: <20070525081631.GB985@ff.dom.local>
[-- Attachment #1: Type: text/plain, Size: 890 bytes --]
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.
[-- Attachment #2: netpoll_workqueue_fix.patch --]
[-- Type: text/plain, Size: 841 bytes --]
Do not call cancel_rearming_delayed_work() if there is no
pending work.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
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);
}
prev parent reply other threads:[~2007-05-25 13:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-25 3:21 [BUG] 2.6.21 hang in cancel_rearming_delayed_workqueue() Jason Wessel
2007-05-25 8:16 ` Jarek Poplawski
2007-05-25 13:21 ` Jason Wessel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4656E2D3.4050106@windriver.com \
--to=jason.wessel@windriver.com \
--cc=jarkao2@o2.pl \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox