[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080506035712.GF2893@hack>
Date: Tue, 6 May 2008 11:57:12 +0800
From: WANG Cong <xiyou.wangcong@...il.com>
To: Herbert Xu <herbert@...dor.apana.org.au>
Cc: WANG Cong <xiyou.wangcong@...il.com>, linux-kernel@...r.kernel.org,
davem@...emloft.net, akpm@...l.org, netdev@...r.kernel.org
Subject: Re: [Patch] (revised) net/xfrm/xfrm_policy.c: replace timer with
delayed_work
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.
View attachment "policy.diff" of type "text/plain" (3004 bytes)
View attachment "state.diff" of type "text/plain" (8352 bytes)
Powered by blists - more mailing lists