From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384522; b=WvCWANcL0lNFDSE7Kb52R9W4d2BwTRQkEve6l0ETjVEZZwDUKRP4BxgfOa8c0keOkOaE RsG4Hi9Lngm6LXvpnPUywxf4kMgZJmwebr0y0fkMUUNh3NSRMLBHncraq8czaGFjZUxmF 7bJ2QT9XJ2aWv9JkxHLNZCe7JwoFoP2d3aFpUGvtO1vD3/iglWbA4T8t3ogk9/NAsSv3E nJ9+aqv1d58sqbW+8oKBgcQDZSARbo9SdWjSURIJnZv913xG+oXYkDmygDLFuGzah/kbe vOcadTPN1vKkNYiPJ7YxheAY4mjgdQG21jHFqFWZYhuOxWUi19qLUtvi41/VsK+dCCQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384522; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=I+N0K8l3qc5KU2pt7SfmENZl8IxK0agtzMT1SHxakuk=; b=m86ehzd5dO6lMIfJfcwP4V1fBC2AgG7bzriG7vtGwRg6fo12YGvzBiRIhUi8gcJzalZa Ij+RJiAu51Lxb1q+o3CA4JPsDt5QANosraky1gUa02uMrmVErz034ULpWUE2VB0q3LtcD a/A/6wdM1qnqyx2TADLyNpPjDI7WQMgla9i/G81TAJN4JDrv/PfdiI1bwCASbnHkvUtmN By56Ch11OQcjF5MTXQf/XBAPokSZsEYRqiB10HnIBbn3DMTGyne3CngiRBjS3UhtmjUJc NrAJGedmcOQDMos5xdcouQ/zaiyo0ttGtaD8ssg3vP1G8R8At825eRGv1Ep6QBSIqeA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rVz8IeR5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37E58606A33F; Fri, 4 Dec 2026 11:42:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=rVz8IeR5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A203A1F00A05; Fri, 4 Dec 2026 11:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384522; bh=I+N0K8l3qc5KU2pt7SfmENZl8IxK0agtzMT1SHxakuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rVz8IeR5vKoPZEY78fr8hKNchVlf6sx9Ye5T55lZPlzBvETx8yS1XmQrGYQrlkguW fLq7vcflxwlnGqwwh9VV5mQMRc+Ha29DSXn5Dw52pDizSzveLidoryCG9VRZQighLN zW8dTQR1b0L+CXXBISk59r1aCCLdfCZuKXYQO4Oo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marek Szyprowski , Srikanth Aithal , Christian Brauner , Sasha Levin Subject: [PATCH 6.6 0185/1167] init: flush async file closing Date: Fri, 4 Dec 2026 18:53:32 +0900 Message-ID: <20261204100706.886953690@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Brauner [ Upstream commit 386dc41cf54dcf44ea40de1aca900f02b756cec0 ] When unpacking the initramfs or when mounting block devices we need to ensure that any delayed fput() finished to prevent spurious errors. The init process can be a proper kernel thread or a user mode helper. In the latter case PF_KTHREAD isn't set. So we need to do both flush_delayed_work() and task_work_run(). Since we'll port block device opening and closing to regular file open and closing we need to ensure the same as for the initramfs. So just make that a little helper. Tested-by: Marek Szyprowski Tested-by: Srikanth Aithal Link: https://lore.kernel.org/r/CA+G9fYttTwsbFuVq10igbSvP5xC6bf_XijM=mpUqrJV=uvUirQ@mail.gmail.com Signed-off-by: Christian Brauner Signed-off-by: Sasha Levin --- init/do_mounts.c | 3 +++ init/do_mounts.h | 9 +++++++++ init/initramfs.c | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/init/do_mounts.c b/init/do_mounts.c index 21d065a55ad88..ce8fc1c2b715c 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -208,6 +208,9 @@ void __init mount_root_generic(char *name, char *pretty_name, int flags) goto out; case -EACCES: case -EINVAL: +#ifdef CONFIG_BLOCK + init_flush_fput(); +#endif continue; } /* diff --git a/init/do_mounts.h b/init/do_mounts.h index 15e372b00ce70..6069ea3eb80d7 100644 --- a/init/do_mounts.h +++ b/init/do_mounts.h @@ -9,6 +9,8 @@ #include #include #include +#include +#include void mount_root_generic(char *name, char *pretty_name, int flags); void mount_root(char *root_device_name); @@ -41,3 +43,10 @@ static inline bool initrd_load(char *root_device_name) } #endif + +/* Ensure that async file closing finished to prevent spurious errors. */ +static inline void init_flush_fput(void) +{ + flush_delayed_fput(); + task_work_run(); +} diff --git a/init/initramfs.c b/init/initramfs.c index 148988bd8ab27..35480c5053311 100644 --- a/init/initramfs.c +++ b/init/initramfs.c @@ -16,9 +16,10 @@ #include #include #include -#include #include +#include "do_mounts.h" + static __initdata bool csum_present; static __initdata u32 io_csum; @@ -735,8 +736,7 @@ static void __init do_populate_rootfs(void *unused, async_cookie_t cookie) initrd_start = 0; initrd_end = 0; - flush_delayed_fput(); - task_work_run(); + init_flush_fput(); } static ASYNC_DOMAIN_EXCLUSIVE(initramfs_domain); -- 2.53.0