Re: [PATCH] make-cancel_rearming_delayed_work-reliable-fix

Oleg Nesterov
2007-05-07T12:28:09Z

On 05/07, Anton Vorontsov wrote:
>
> I guess pseudo code below is not that strange, but real usecase:
>
> probe()
> {
> INIT_DELAYED_WORK(...);
> /* we're not issuing queue_delayed_work() in probe(), work will
> * be started by interrupt */
> return;
> }
>
> remove()
> {
> /* hang will happen here if there was no queue_delyed_work()
> * call (like there was no interrupts, which starts rearming
> * work */
> cancel_rearming_delayed_work();
> }
>
>
> Your patch will fix it, right?

Yes, the new implemantation should work correctly.

However, this particular case was already fixed earlier,

workqueue-make-cancel_rearming_delayed_workqueue-work-on-idle-dwork.patch
http://marc.info/?l=linux-mm-commits&m=117081275901499

Note that INIT_DELAYED_WORK() sets work->data = 0, and
cancel_rearming_delayed_work() does "Was it ever queued"
check.

Still, before this patch, cancel_rearming_delayed_work() hangs
if this work was used before, but not active + re-arming now.

Oleg.