Linux filesystem development
 help / color / mirror / Atom feed
From: Shigeru Yoshida <syoshida@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Christian Brauner <brauner@kernel.org>,
	Eric Sandeen <sandeen@redhat.com>
Cc: linux-fsdevel@vger.kernel.org,
	Shigeru Yoshida <syoshida@redhat.com>,
	driver-core@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH] devtmpfs: apply mount options to the existing superblock
Date: Mon, 24 Aug 2026 04:12:53 +0900	[thread overview]
Message-ID: <20260823191254.3696641-1-syoshida@redhat.com> (raw)

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


             reply	other threads:[~2026-08-23 19:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 19:12 Shigeru Yoshida [this message]
2026-08-24  5:08 ` [PATCH] devtmpfs: apply mount options to the existing superblock Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260823191254.3696641-1-syoshida@redhat.com \
    --to=syoshida@redhat.com \
    --cc=brauner@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=sandeen@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox