virtio-fs: don't show mount options

Virtio-fs does not accept any mount options, so it's confusing and wrong to
show any in /proc/mounts.

Reported-by: Stefan Hajnoczi <stefanha@redhat.com> 
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
Miklos Szeredi 2019-10-15 16:11:41 +02:00
parent 112e72373d
commit 3f22c74671
3 changed files with 9 additions and 0 deletions

View File

@ -479,6 +479,7 @@ struct fuse_fs_context {
bool destroy:1; bool destroy:1;
bool no_control:1; bool no_control:1;
bool no_force_umount:1; bool no_force_umount:1;
bool no_mount_options:1;
unsigned int max_read; unsigned int max_read;
unsigned int blksize; unsigned int blksize;
const char *subtype; const char *subtype;
@ -713,6 +714,9 @@ struct fuse_conn {
/** Do not allow MNT_FORCE umount */ /** Do not allow MNT_FORCE umount */
unsigned int no_force_umount:1; unsigned int no_force_umount:1;
/* Do not show mount options */
unsigned int no_mount_options:1;
/** The number of requests waiting for completion */ /** The number of requests waiting for completion */
atomic_t num_waiting; atomic_t num_waiting;

View File

@ -558,6 +558,9 @@ static int fuse_show_options(struct seq_file *m, struct dentry *root)
struct super_block *sb = root->d_sb; struct super_block *sb = root->d_sb;
struct fuse_conn *fc = get_fuse_conn_super(sb); struct fuse_conn *fc = get_fuse_conn_super(sb);
if (fc->no_mount_options)
return 0;
seq_printf(m, ",user_id=%u", from_kuid_munged(fc->user_ns, fc->user_id)); seq_printf(m, ",user_id=%u", from_kuid_munged(fc->user_ns, fc->user_id));
seq_printf(m, ",group_id=%u", from_kgid_munged(fc->user_ns, fc->group_id)); seq_printf(m, ",group_id=%u", from_kgid_munged(fc->user_ns, fc->group_id));
if (fc->default_permissions) if (fc->default_permissions)
@ -1180,6 +1183,7 @@ int fuse_fill_super_common(struct super_block *sb, struct fuse_fs_context *ctx)
fc->destroy = ctx->destroy; fc->destroy = ctx->destroy;
fc->no_control = ctx->no_control; fc->no_control = ctx->no_control;
fc->no_force_umount = ctx->no_force_umount; fc->no_force_umount = ctx->no_force_umount;
fc->no_mount_options = ctx->no_mount_options;
err = -ENOMEM; err = -ENOMEM;
root = fuse_get_root_inode(sb, ctx->rootmode); root = fuse_get_root_inode(sb, ctx->rootmode);

View File

@ -992,6 +992,7 @@ static int virtio_fs_fill_super(struct super_block *sb)
.destroy = true, .destroy = true,
.no_control = true, .no_control = true,
.no_force_umount = true, .no_force_umount = true,
.no_mount_options = true,
}; };
mutex_lock(&virtio_fs_mutex); mutex_lock(&virtio_fs_mutex);