Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH] devtmpfs: apply mount options to the existing superblock
@ 2026-08-23 19:12 Shigeru Yoshida
  2026-08-24  5:08 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Shigeru Yoshida @ 2026-08-23 19:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	Christian Brauner, Eric Sandeen
  Cc: linux-fsdevel, Shigeru Yoshida, driver-core, linux-kernel

Commit cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in
public instance") dropped the reconfigure_single() call that
public_dev_mount() used to apply the options of every new mount to the
single, internally created superblock. devtmpfs_get_tree() only takes
a reference on it: the options are still parsed into fc->fs_private,
but ->reconfigure is now only reached via reconfigure_super(), i.e. on
remount, so they are discarded by put_fs_context().

For example, systemd mounts /dev with "-o mode=755,size=4m,nr_inodes=1m",
so size= is silently ignored and /dev falls back to the tmpfs default of
50% of physical RAM.

Call the underlying ->reconfigure from devtmpfs_get_tree(), the same
way tracefs and debugfs do; ramfs has no ->reconfigure, hence the NULL
check.

This restores the behaviour of commit a6097180d884 ("devtmpfs
regression fix: reconfigure on each mount"), which fixed the same
regression when devtmpfs was first converted away from mount_single().

Fixes: cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in public instance")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
 drivers/base/devtmpfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index aef0fcc6aba1..f0798fc1bc34 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -80,6 +80,18 @@ static int devtmpfs_get_tree(struct fs_context *fc)
 	atomic_inc(&sb->s_active);
 	down_write(&sb->s_umount);
 	fc->root = dget(sb->s_root);
+
+	if (fc->ops->reconfigure) {
+		int err = fc->ops->reconfigure(fc);
+
+		if (err) {
+			dput(fc->root);
+			fc->root = NULL;
+			deactivate_locked_super(sb);
+			return err;
+		}
+	}
+
 	return 0;
 }
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] devtmpfs: apply mount options to the existing superblock
  2026-08-23 19:12 [PATCH] devtmpfs: apply mount options to the existing superblock Shigeru Yoshida
@ 2026-08-24  5:08 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2026-08-24  5:08 UTC (permalink / raw)
  To: Shigeru Yoshida
  Cc: Rafael J. Wysocki, Danilo Krummrich, Christian Brauner,
	Eric Sandeen, linux-fsdevel, driver-core, linux-kernel

On Mon, Aug 24, 2026 at 04:12:53AM +0900, Shigeru Yoshida wrote:
> Commit cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in
> public instance") dropped the reconfigure_single() call that
> public_dev_mount() used to apply the options of every new mount to the
> single, internally created superblock. devtmpfs_get_tree() only takes
> a reference on it: the options are still parsed into fc->fs_private,
> but ->reconfigure is now only reached via reconfigure_super(), i.e. on
> remount, so they are discarded by put_fs_context().
> 
> For example, systemd mounts /dev with "-o mode=755,size=4m,nr_inodes=1m",
> so size= is silently ignored and /dev falls back to the tmpfs default of
> 50% of physical RAM.
> 
> Call the underlying ->reconfigure from devtmpfs_get_tree(), the same
> way tracefs and debugfs do; ramfs has no ->reconfigure, hence the NULL
> check.
> 
> This restores the behaviour of commit a6097180d884 ("devtmpfs
> regression fix: reconfigure on each mount"), which fixed the same
> regression when devtmpfs was first converted away from mount_single().
> 
> Fixes: cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in public instance")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
> ---
>  drivers/base/devtmpfs.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Isn't this solved with this series:
	https://lore.kernel.org/r/20260810083438.764684-1-simonlie@amazon.de
?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-24  5:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-23 19:12 [PATCH] devtmpfs: apply mount options to the existing superblock Shigeru Yoshida
2026-08-24  5:08 ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox