Re: [PATCH 6/7] rust: workqueue: add Work::cancel_work_sync()

"Danilo Krummrich" <[email protected]>
Newsgroups dev.linux.lists.driver-core,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>
On Fri Aug 7, 2026 at 3:37 AM CEST, John Hubbard wrote:
> This seems to expose a way for driver writers to leak work items,
> doesn't it?

Yes, I forgot about this for a second; this should be on ScopedWork only (at
least without further effort to make it work properly for Work too).

Since you explicitly mention "driver writers", note that unbounded work
shouldn't really have any (valid) use-cases within drivers. So drivers should
either use ScopedQueue or ScopedWork.

It is of course possible to use Work with a ScopedQueue, but at this point it is
unnecessary; the requirement is already that the Work must outlive the
ScopedQueue. So using ScopedWork instead saves an otherwise unnecessary
allocation and reference count.

(I also noticed that the run() callback of ScopedWork should pass
&ScopedWork<Self> instead of just &Self, such that self-requeue is easily
possible; I will add this in v2.)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.