Skip to content

Commit 0084fef

Browse files
neilbrowngregkh
authored andcommitted
devtmpfs regression fix: reconfigure on each mount
commit a609718 upstream. Prior to Linux v5.4 devtmpfs used mount_single() which treats the given mount options as "remount" options, so it updates 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 affect systemd - which mounts devtmpfs with "-o mode=755,size=4m,nr_inodes=1m". This patch restores the "remount" effect by calling reconfigure_single() Fixes: d401727 ("devtmpfs: don't mix {ramfs,shmem}_fill_super() with mount_single()") Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ee40594 commit 0084fef

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

drivers/base/devtmpfs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,15 @@ static struct dentry *public_dev_mount(struct file_system_type *fs_type, int fla
5959
const char *dev_name, void *data)
6060
{
6161
struct super_block *s = mnt->mnt_sb;
62+
int err;
63+
6264
atomic_inc(&s->s_active);
6365
down_write(&s->s_umount);
66+
err = reconfigure_single(s, flags, data);
67+
if (err < 0) {
68+
deactivate_locked_super(s);
69+
return ERR_PTR(err);
70+
}
6471
return dget(s->s_root);
6572
}
6673

fs/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,8 +1472,8 @@ struct dentry *mount_nodev(struct file_system_type *fs_type,
14721472
}
14731473
EXPORT_SYMBOL(mount_nodev);
14741474

1475-
static int reconfigure_single(struct super_block *s,
1476-
int flags, void *data)
1475+
int reconfigure_single(struct super_block *s,
1476+
int flags, void *data)
14771477
{
14781478
struct fs_context *fc;
14791479
int ret;

include/linux/fs_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ extern int generic_parse_monolithic(struct fs_context *fc, void *data);
140140
extern int vfs_get_tree(struct fs_context *fc);
141141
extern void put_fs_context(struct fs_context *fc);
142142
extern void fc_drop_locked(struct fs_context *fc);
143+
int reconfigure_single(struct super_block *s,
144+
int flags, void *data);
143145

144146
/*
145147
* sget() wrappers to be called from the ->get_tree() op.

0 commit comments

Comments
 (0)