diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 835bb6024f7d47d1388c35212f9d22fd5f61c3e0..379ea2a9a70a1e6f69ea9d3b085fdd66610d5f8e 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1002,7 +1002,7 @@ void fuse_dev_free(struct fuse_dev *fud); * Parse a mount options string */ int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev, - struct user_namespace *user_ns); + struct user_namespace *user_ns, int is_virtiofs); /** * Fill in superblock and initialize fuse connection diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 2e622217c539b09ac9b5b7523403efa4dbd2b5b5..e647c56f7b220270e05c0968cd009a860fd089f1 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -468,13 +468,19 @@ static int fuse_match_uint(substring_t *s, unsigned int *res) } int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev, - struct user_namespace *user_ns) + struct user_namespace *user_ns, int is_virtiofs) { char *p; memset(d, 0, sizeof(struct fuse_mount_data)); d->max_read = ~0; d->blksize = FUSE_DEFAULT_BLKSIZE; + if (is_virtiofs) { + d->rootmode = S_IFDIR; + d->default_permissions = 1; + d->allow_other = 1; + } + while ((p = strsep(&opt, ",")) != NULL) { int token; int value; @@ -549,6 +555,10 @@ int parse_fuse_opt(char *opt, struct fuse_mount_data *d, int is_bdev, } } + /* no need to check rootmode/user_id/group_id for virtiofs */ + if (is_virtiofs) + return 1; + if (!d->rootmode_present || !d->user_id_present || !d->group_id_present) return 0; @@ -1201,7 +1211,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) struct fuse_req *init_req; err = -EINVAL; - if (!parse_fuse_opt(data, &d, is_bdev, sb->s_user_ns)) + if (!parse_fuse_opt(data, &d, is_bdev, sb->s_user_ns, false)) goto err; if (!d.fd_present) goto err; diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 4a8195a5b26aa413d9f9d4b88bc458cc6bea16ba..1e919633c8fc4f1f6256fd09075451e2b2150f2e 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -1035,7 +1035,7 @@ static int virtio_fs_fill_super(struct super_block *sb, void *data, mutex_lock(&virtio_fs_mutex); err = -EINVAL; - if (!parse_fuse_opt(data, &d, is_bdev, sb->s_user_ns)) + if (!parse_fuse_opt(data, &d, is_bdev, sb->s_user_ns, true)) goto err; if (d.fd_present) {