[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070208003927.d8f8cb78.akpm@linux-foundation.org>
Date: Thu, 8 Feb 2007 00:39:27 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Oleg Nesterov <oleg@...sign.ru>
Cc: Horms <horms@...ge.net.au>, Daniel Drake <dsd@...too.org>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH 3/6] workqueue: make cancel_rearming_delayed_workqueue()
work on idle dwork
On Thu, 8 Feb 2007 11:35:39 +0300 Oleg Nesterov <oleg@...sign.ru> wrote:
> On 02/08, Horms wrote:
> >
> > On Wed, Feb 07, 2007 at 08:43:55PM +0300, Oleg Nesterov wrote:
> > >
> > > I think we have another problem with delayed_works.
> > >
> > > cancel_rearming_delayed_workqueue() doesn't garantee that the ->func() is not
> > > running upon return. I don't know if it is bug or not, the comment says nothing
> > > about that.
> > >
> > > However, we have the callers which seem to assume the opposite, example
> > >
> > > net/ipv4/ipvs/ip_vs_core.c
> > >
> > > module_exit
> > > ip_vs_cleanup
> > > ip_vs_control_cleanup
> > > cancel_rearming_delayed_work
> > > // done
> > >
> > > This is unsafe. The module may be unloaded and the memory may be freed
> > > while defense_work_handler() is still running/preempted.
> > >
> > > Unless I missed something, which side should be fixed?
> >
> > Assuming the decision is to fix the ipvs side, is the fix
> > just to remove the call to cancel_rearming_delayed_work() in
> > ip_vs_control_cleanup() ?
>
> I think ip_vs_control_cleanup() should also do flush_workqueue() after
> cancel_rearming_delayed_work().
>
> This is ugly, because we have flush_work() but can't use it on delayed
> works. This is possible to change, but not so trivial.
>
> Andrew, do you think it is worth to tweak delayed works so it would be
> possible to use flush_work(dwork->work) ?
>
I've completely lost track of what you've been doing in there (this is a
problem) but sure, if the patch isn't too horrid it's always better to be
robust in the core than to have to work around inadequacies in the callers.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists