All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH - regression] devtmpfs: reconfigure on each mount
@ 2021-12-13  1:12 NeilBrown
  2021-12-13 12:59 ` Christian Brauner
  0 siblings, 1 reply; 11+ messages in thread
From: NeilBrown @ 2021-12-13  1:12 UTC (permalink / raw)
  To: Al Viro, David Howells, Greg Kroah-Hartman; +Cc: LKML, linux-fsdevel


Prior to Linux v5.4 devtmpfs used mount_single() which treats the given
mount options as "remount" options, updating the configuration of the
single super_block on each mount.
Since that was changed, the mount options used for devtmpfs are ignored.
This is a regression which affects systemd - which mounts devtmpfs
with "-o mode=755,size=4m,nr_inodes=1m".

This patch restores the "remount" effect by calling reconfigure_single()

Fixes: d401727ea0d7 ("devtmpfs: don't mix {ramfs,shmem}_fill_super() with mount_single()")
Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/base/devtmpfs.c    | 7 +++++++
 fs/super.c                 | 4 ++--
 include/linux/fs_context.h | 2 ++
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 8be352ab4ddb..fa13ad49d211 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -59,8 +59,15 @@ static struct dentry *public_dev_mount(struct file_system_type *fs_type, int fla
 		      const char *dev_name, void *data)
 {
 	struct super_block *s = mnt->mnt_sb;
+	int err;
+
 	atomic_inc(&s->s_active);
 	down_write(&s->s_umount);
+	err = reconfigure_single(s, flags, data);
+	if (err < 0) {
+		deactivate_locked_super(s);
+		return ERR_PTR(err);
+	}
 	return dget(s->s_root);
 }
 
diff --git a/fs/super.c b/fs/super.c
index 3bfc0f8fbd5b..a6405d44d4ca 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -1423,8 +1423,8 @@ struct dentry *mount_nodev(struct file_system_type *fs_type,
 }
 EXPORT_SYMBOL(mount_nodev);
 
-static int reconfigure_single(struct super_block *s,
-			      int flags, void *data)
+int reconfigure_single(struct super_block *s,
+		       int flags, void *data)
 {
 	struct fs_context *fc;
 	int ret;
diff --git a/include/linux/fs_context.h b/include/linux/fs_context.h
index 6b54982fc5f3..13fa6f3df8e4 100644
--- a/include/linux/fs_context.h
+++ b/include/linux/fs_context.h
@@ -142,6 +142,8 @@ extern void put_fs_context(struct fs_context *fc);
 extern int vfs_parse_fs_param_source(struct fs_context *fc,
 				     struct fs_parameter *param);
 extern void fc_drop_locked(struct fs_context *fc);
+int reconfigure_single(struct super_block *s,
+		       int flags, void *data);
 
 /*
  * sget() wrappers to be called from the ->get_tree() op.
-- 
2.34.1


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

end of thread, other threads:[~2022-01-17 22:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13  1:12 [PATCH - regression] devtmpfs: reconfigure on each mount NeilBrown
2021-12-13 12:59 ` Christian Brauner
2021-12-13 20:46   ` Anthony Iliopoulos
2021-12-14 10:12     ` Christian Brauner
2021-12-14 14:06       ` Anthony Iliopoulos
2021-12-14 14:18         ` Christian Brauner
2022-01-16 22:07           ` [PATCH - resend] devtmpfs regression fix: " NeilBrown
2022-01-17  7:47             ` Linus Torvalds
2022-01-17 22:57               ` NeilBrown
2022-01-17  8:03             ` Greg Kroah-Hartman
2022-01-17  8:04               ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.