Re: [PATCH] workqueue: don't skip lockdep wq dependency in cancel_work_sync()

From: Tetsuo Handa
Date: Thu Jul 28 2022 - 22:50:27 EST


On 2022/07/29 11:28, Tetsuo Handa wrote:
> Thinking more, I might be confused by difference between
>
> the lockdep "struct work_struct" dependency handling

the lockdep "struct workqueue_struct" dependency handling

>
> and
>
> the lockdep "struct work" dependency handling

the lockdep "struct work_struct" dependency handling


On 2022/07/29 11:38, Lai Jiangshan wrote:
> The commit fd1a5b04dfb8("workqueue: Remove now redundant lock
> acquisitions wrt. workqueue flushes") removed this lockdep check.
>
> And the commit 87915adc3f0a("workqueue: re-add lockdep
> dependencies for flushing") added it back for non-canceling cases.
>
> It seems the commit fd1a5b04dfb8 is the culprit and 87915adc3f0a
> didn't fixes all the problem of it.
>
> So it is better to complete 87915adc3f0a by making __flush_work()
> does lock_map_acquire(&work->lockdep_map) for both canceling and
> non-canceling cases.

Yes, commit 87915adc3f0acdf0 was incomplete.