Re: [PATCH v2] igb: Fix watchdog_task race with shutdown

From: Ian Ray
Date: Mon Jun 09 2025 - 02:33:19 EST


On Thu, Jun 05, 2025 at 06:43:39PM -0700, Jakub Kicinski wrote:
> On Tue, 3 Jun 2025 11:09:49 +0300 Ian Ray wrote:
> > set_bit(__IGB_DOWN, &adapter->state);
> > + timer_delete_sync(&adapter->watchdog_timer);
> > + timer_delete_sync(&adapter->phy_info_timer);
> > +
> > + cancel_work_sync(&adapter->watchdog_task);
>
> This doesn't look very race-proof as watchdog_task
> can schedule the timer as its last operation?

Thanks for the reply. __IGB_DOWN is the key to this design.

If watchdog_task runs *before* __IGB_DOWN is set, then the
timer is stopped (by this patch) as required.

However, if watchdog_task runs *after* __IGB_DOWN is set,
then the timer will not even be started (by watchdog_task).

Regards,
Ian