Re: [PATCH RFC] virtio_net: fix refill related races
From: Tejun Heo
Date: Wed Dec 14 2011 - 18:54:18 EST
Hello, Rusty.
On Tue, Dec 13, 2011 at 01:05:11PM +1030, Rusty Russell wrote:
> Both places where we call:
>
> cancel_delayed_work_sync(&vi->refill);
>
> Do not actually guarantee that vi->refill isn't running, because it
> can requeue itself. A 'bool no_more_refill' field seems like the
> simplest fix for this, but I don't think it's sufficient.
>
> Tejun, is this correct? What's the correct way to synchronously stop a
> delayed_work which can "schedule_delayed_work(&vi->refill, HZ/2);" on
> itself?
cancel_delayed_work_sync() itself should be good enough. It first
steals the pending state and then waits for it to finish if in-flight.
Queueing itself afterwards becomes noop.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/