Tejun Heo <tj@xxxxxxxxxx> writes: > Hello, > > On Sat, Sep 03, 2022 at 07:11:18PM -0700, Luiz Augusto von Dentz wrote: >> And we can check for __WQ_DRAINING? Anyway checking > > Please don't do that. That's an internal flag. It shouldn't be *that* > difficult to avoid this without peeking into wq internal state. > > Thanks. It seems we only need to change hdev->{cmd,ncmd}_timer to hdev->workqueue, there will be no race because drain_workqueue will flush all pending work internally. Any new timeout work will see HCI_CMD_DRAIN_WORKQUEUE flags after we cancel and flushed all the delayed work. -- BRs Schspa Shi