On 04/27, Andrew Morton wrote:
>
> It'd be good if people could take some time to sit down and re-review the
> code which we presently have. I plan on sending it all off for 2.6.22 and
> there might be some glitches but it seems to have a good track record so
> far.
Alan, the usage of cancel_delayed_work() in drivers/ata/libata-core.c looks
suspicious to me, both ->hotplug_task and ->port_task can re-arm themselves,
so cancel_delayed_work + flush_workqueue (or cancel_work_sync) is not enough.
Could you confirm/nack my understanding?
Oleg.
Oleg Nesterov wrote:
> On 04/27, Andrew Morton wrote:
>> It'd be good if people could take some time to sit down and re-review the
>> code which we presently have. I plan on sending it all off for 2.6.22 and
>> there might be some glitches but it seems to have a good track record so
>> far.
>
> Alan, the usage of cancel_delayed_work() in drivers/ata/libata-core.c looks
> suspicious to me, both ->hotplug_task and ->port_task can re-arm themselves,
> so cancel_delayed_work + flush_workqueue (or cancel_work_sync) is not enough.
>
> Could you confirm/nack my understanding?
For all rearming workqueues, one must use cancel-rearming-blahblah.
Jeff
On 05/01, Jeff Garzik wrote:
>
> Oleg Nesterov wrote:
> >
> >Alan, the usage of cancel_delayed_work() in drivers/ata/libata-core.c looks
> >suspicious to me, both ->hotplug_task and ->port_task can re-arm
> >themselves,
> >so cancel_delayed_work + flush_workqueue (or cancel_work_sync) is not
> >enough.
> >
> >Could you confirm/nack my understanding?
>
> For all rearming workqueues, one must use cancel-rearming-blahblah.
Well, yes and no. cancel_rearming_delayed_work() requires that dwork
re-arms itself unconditionally, otherwise it just hangs (actually, the
patch to fix this shortcoming is ready). However, ata_pio_task() for
example, re-arms only when ATA_BUSY.
So it is very possible that the code is correct, if the caller of
ata_port_flush_task() ensures that ATA_BUSY is not possible. Otherwise
we should change cancel_rearming_delayed_work() and use it.
Oleg.