Re: [PATCH can-next v7 6/6] can: gs_usb: properly shut down timestamp worker
From: netdev-bot+sashiko
Date: Sun Nov 15 2026 - 23:18:49 EST
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message gives the wrong reason for the change.
--
can: gs_usb: properly shut down timestamp worker
This commit disables the timestamp delayed work at init time, enables it
in gs_usb_timestamp_start(), and switches gs_usb_timestamp_stop() from
cancel_delayed_work_sync() to disable_delayed_work_sync().
> To avoid self-rescheduling of the timestamp worker, shut it down using
> disable_delayed_work_sync() instead of cancel_delayed_work_sync().
[Severity: Low]
Is this reason accurate? cancel_delayed_work_sync() already seems to
handle a self-requeueing work.
cancel_delayed_work_sync() goes through __cancel_work_sync(), and that
function always disables the work before it flushes. It only re-enables
the work after the callback has finished:
kernel/workqueue.c:__cancel_work_sync() {
...
ret = __cancel_work(work, cflags | WORK_CANCEL_DISABLE);
...
if (wq_online)
__flush_work(work, true);
if (!(cflags & WORK_CANCEL_DISABLE))
enable_work(work);
...
}
Suppose gs_usb_timestamp_work() requeues itself while the flush is
waiting:
drivers/net/can/usb/gs_usb.c:gs_usb_timestamp_work() {
...
schedule_delayed_work(&parent->timestamp,
GS_USB_TIMESTAMP_WORK_DELAY_SEC * HZ);
}
The work is still disabled at that point, so the requeue is rejected.
The kernel-doc for cancel_work_sync() also says it "can be used even if
the work re-queues itself".
The only other place that queues parent->timestamp is
gs_usb_timestamp_start(). It runs from gs_can_open() under RTNL, and
only when parent->active_channels == 0. Leaving the work enabled
between stop and start therefore does not appear to be reachable as a
bug.
The enable/disable count added by this patch looks balanced across the
init, start, stop, and open error paths.
The parent commit, "can: gs_usb: fix hardware timestamp state for mixed
channels" (Cc: stable), says this follow-up is needed to avoid
self-rescheduling the timestamp worker. It also says it was split out
to simplify backporting. Together, the two messages could suggest that
stable kernels without this patch still have a live self-rescheduling
bug. Older kernels also blocked the self-requeue during cancel, through
WORK_OFFQ_CANCELING.
Could the commit message describe this as cleanup or hardening, making
the stopped state explicit, rather than as a fix for self-rescheduling?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261114-gs_usb-fixes-v7-0-58b6341b1c08%40pengutronix.de