From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74708436374; Fri, 27 Feb 2026 15:10:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772205016; cv=none; b=jx/YmtVO4kEM0SO+P+11Gdf/EPbweAnCKdLDawo8GbfAYtB5poV8M0/wjUR/YQLhTDp6y27USiHTuV7ClhH6yoC0zQojssHvhqYm5KrKLdLLPRPRtCLXM+Wv/KDzt0abevbA9fmHTdZIDtLvLStLCfbO63QTyZ/wlETU0cJd4J0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772205016; c=relaxed/simple; bh=A+0kNftCTVHBA/gr9wUYwklcGsNkEFj9fn64fLK4cMo=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=ZzlkfkgD4BICHlCMranid61sj8uwF9EiyVYi1v7BOq5nF7e/VmoTIHO5FlFtqTVw90t6MeYpP52kfmxEskHS79D/0KjloeO8hDmpMWvLwn2jn1rK2sjsIVM22MIX7i9UPbf22dUz4Q+AAl6hV/2Y/akTRr7vJxC5cxmWWvvTQw4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=R3wOU3bP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="R3wOU3bP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D05F1C19422; Fri, 27 Feb 2026 15:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772205016; bh=A+0kNftCTVHBA/gr9wUYwklcGsNkEFj9fn64fLK4cMo=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=R3wOU3bPwzjVMt88qdYanywyywgh6ijFhqoRxoky1je2i+67QUwTqzbwB/aUNVoWR 5d7hAysaLWZy1DUGSgqG5K5EBU43ZW2MyEqlibvaX96sDOiWFHFOqYM8WkSGbkwgNc G1HNKqKhPrByUtdy3MyH8f4joH+smKTQO6uddbQJDtGhebmWPiFdv0AIDlFC4R78i6 TuC4eX8Z4hDJkeAwJmGi4/LnSJH8IL1ai7mB9jxJxEQUmfUZSG6d9cVl6+ZGIpkmzH zmTnuaPnXYoGVy+mL5be4gFXPaeV4fnmZa2wRLtKFn0Pwc1ZqvqcEiUFteTaFLLq8U WT7ypYWwdKz6A== Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 27 Feb 2026 16:10:11 +0100 Message-Id: Subject: Re: [PATCH v3 1/2] rust: workqueue: restrict delayed work to global wqs Cc: "Tejun Heo" , "Miguel Ojeda" , "Lai Jiangshan" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Trevor Gross" , "Daniel Almeida" , "John Hubbard" , "Philipp Stanner" , , , "Boqun Feng" , "Benno Lossin" , "Tamir Duberstein" , To: "Alice Ryhl" From: "Danilo Krummrich" References: <20260227-create-workqueue-v3-0-87de133f7849@google.com> <20260227-create-workqueue-v3-1-87de133f7849@google.com> In-Reply-To: <20260227-create-workqueue-v3-1-87de133f7849@google.com> On Fri Feb 27, 2026 at 3:53 PM CET, Alice Ryhl wrote: > When a workqueue is shut down, delayed work that is pending but not > scheduled does not get properly cleaned up, so it's not safe to use > `enqueue_delayed` on a workqueue that might be destroyed. To fix this, > restricted `enqueue_delayed` to static queues. :( Reviewed-by: Danilo Krummrich > Cc: stable@vger.kernel.org > Fixes: 7c098cd5eaae ("workqueue: rust: add delayed work items") > Reviewed-by: John Hubbard > Signed-off-by: Alice Ryhl > --- > rust/kernel/workqueue.rs | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs > index 706e833e9702..1acd113c04ee 100644 > --- a/rust/kernel/workqueue.rs > +++ b/rust/kernel/workqueue.rs > @@ -296,8 +296,15 @@ pub fn enqueue(&self, w: W) -> W::= EnqueueOutput > /// > /// This may fail if the work item is already enqueued in a workqueu= e. > /// > + /// This is only valid for global workqueues (with static lifetimes)= because those are the only > + /// ones that outlive all possible delayed work items. We should probably add a FIXME comment pointing out that this should be fix= ed in the C code. Maybe also link your approach? > + /// > /// The work item will be submitted using `WORK_CPU_UNBOUND`. > - pub fn enqueue_delayed(&self, w: W, delay: Jiffies= ) -> W::EnqueueOutput > + pub fn enqueue_delayed( > + &'static self, > + w: W, > + delay: Jiffies, > + ) -> W::EnqueueOutput > where > W: RawDelayedWorkItem + Send + 'static, > { > > --=20 > 2.53.0.473.g4a7958ca14-goog