Skip to content

Commit

Permalink
devtmpfs regression fix: reconfigure on each mount
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
neilbrown authored and torvalds committed Jan 17, 2022
1 parent 3c750c7 commit a609718
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions drivers/base/devtmpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,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);
}

Expand Down
4 changes: 2 additions & 2 deletions fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/linux/fs_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit a609718

Please sign in to comment.