Skip to contentSkip to conversation

devtmpfs: apply mount options to the existing superblock

PATCH In review Shigeru Yoshida 2 participants 2 messages Aug 23 – Aug 24

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtmpfs: apply mount options to the existing superblock

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")
Assisted-by Claude:claude-opus-5
---
 drivers/base/devtmpfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/base/devtmpfs.c +12 -0
index aef0fcc6aba1..f0798fc1bc34 100644
@@ -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;
 }
 
Signature · 1 line
2.55.0
#1 lore raw
Quoted 20 lines · Shigeru Yoshida

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().

Quoted 7 lines
Fixes cb0e0a8bf4e1 ("devtmpfs: replace ->mount with ->get_tree in public instance")
Assisted-by Claude:claude-opus-5
---
 drivers/base/devtmpfs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Isn't this solved with this series:

	https://lore.kernel.org/r/[email protected]

?

thanks,

greg k-h