]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
userns: Remove the now unnecessary FS_USERNS_DEV_MOUNT flag
authorEric W. Biederman <ebiederm@xmission.com>
Thu, 9 Jun 2016 20:44:48 +0000 (15:44 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Thu, 23 Jun 2016 20:47:31 +0000 (15:47 -0500)
Now that SB_I_NODEV controls the nodev behavior devpts can just clear
this flag during mount.  Simplifying the code and making it easier
to audit how the code works.  While still preserving the invariant
that s_iflags is only modified during mount.

Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
fs/devpts/inode.c
fs/super.c
include/linux/fs.h

index 37c134a132c7dbaa561cbfe287dec1f6499fa624..d116453b0276634fabb32ee96df9cf96ce9cb25a 100644 (file)
@@ -396,6 +396,7 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
 {
        struct inode *inode;
 
+       s->s_iflags &= ~SB_I_NODEV;
        s->s_blocksize = 1024;
        s->s_blocksize_bits = 10;
        s->s_magic = DEVPTS_SUPER_MAGIC;
@@ -480,7 +481,7 @@ static struct file_system_type devpts_fs_type = {
        .name           = "devpts",
        .mount          = devpts_mount,
        .kill_sb        = devpts_kill_sb,
-       .fs_flags       = FS_USERNS_MOUNT | FS_USERNS_DEV_MOUNT,
+       .fs_flags       = FS_USERNS_MOUNT,
 };
 
 /*
index 25cdceed2ad37eadae32504c8d520643833452c8..37813bf479cfeefb8f334691f27250d53a7edb92 100644 (file)
@@ -206,8 +206,7 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags,
        init_waitqueue_head(&s->s_writers.wait_unfrozen);
        s->s_bdi = &noop_backing_dev_info;
        s->s_flags = flags;
-       if ((s->s_user_ns != &init_user_ns) &&
-           !(type->fs_flags & FS_USERNS_DEV_MOUNT))
+       if (s->s_user_ns != &init_user_ns)
                s->s_iflags |= SB_I_NODEV;
        INIT_HLIST_NODE(&s->s_instances);
        INIT_HLIST_BL_HEAD(&s->s_anon);
index e05983170d2301b1325503e9ea50a01a3b41b2fd..375e37f42cdf6e019e8dcbc1aa687ff44509caeb 100644 (file)
@@ -2022,7 +2022,6 @@ struct file_system_type {
 #define FS_BINARY_MOUNTDATA    2
 #define FS_HAS_SUBTYPE         4
 #define FS_USERNS_MOUNT                8       /* Can be mounted by userns root */
-#define FS_USERNS_DEV_MOUNT    16 /* A userns mount does not imply MNT_NODEV */
 #define FS_RENAME_DOES_D_MOVE  32768   /* FS will handle d_move() during rename() internally. */
        struct dentry *(*mount) (struct file_system_type *, int,
                       const char *, void *);