Thread (17 messages) 17 messages, 3 authors, 2008-05-06

Re: [Patch] (revised) net/xfrm/xfrm_policy.c: replace timer with delayed_work

From: WANG Cong <hidden>
Date: 2008-05-06 03:53:35
Also in: lkml

On Tue, May 06, 2008 at 11:08:22AM +0800, Herbert Xu wrote:
On Fri, May 02, 2008 at 01:35:55PM +0800, WANG Cong wrote:
quoted
@@ -209,16 +210,16 @@ static void xfrm_policy_timer(unsigned long data)
 	if (warn)
 		km_policy_expired(xp, dir, 0, 0);
 	if (next != LONG_MAX &&
-	    !mod_timer(&xp->timer, jiffies + make_jiffies(next)))
+	    !schedule_delayed_work(&xp->work, make_jiffies(next)))
 		xfrm_pol_hold(xp);
I tried it and it pretty much crashed immediately :)

The problem is that schedule_delayed_work's return value is the
opposite of mod_timer.  So you'll need to reverse the tests.
I apologize.

mod_timer() returns 0 if the timer is pending, schedule_delayed_work()
returns 0 when the work is on the queue.

Oh, yes, you're correct!! It's my fault.

And I recheck the source code. I find del_timer() and
cancel_delayed_work() which I also worried about has no such problem.

So just reverse the check for schedule_delayed_work().

Thanks for your kind help! Updated patches are attached.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help