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: >> >> @@ -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.