summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2021-08-04 13:22:58 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2021-08-04 13:22:58 +0200
commitbadc741459f42f51e244533ce1df1cd9ac5ac6d7 (patch)
tree469e60c8275ecedde1c3b417a0e4d09ea22aca44 /fs/fuse
parent84c215075b5723ab946708a6c74c26bd3c51114c (diff)
fuse: move option checking into fuse_fill_super()
Checking whether the "fd=", "rootmode=", "user_id=" and "group_id=" mount options are present can be moved from fuse_get_tree() into fuse_fill_super() where the value of the options are consumed. This relaxes semantics of reusing a fuse blockdev mount using the device name. Before this patch presence of these options were enforced but values ignored, after this patch these options are completely ignored in this case. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/inode.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index d1b1b17b321c..54379a0c86d3 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1514,6 +1514,10 @@ static int fuse_fill_super(struct super_block *sb, struct fs_context *fsc)
struct fuse_conn *fc;
struct fuse_mount *fm;
+ if (!ctx->fd_present || !ctx->rootmode_present ||
+ !ctx->user_id_present || !ctx->group_id_present)
+ return -EINVAL;
+
err = -EINVAL;
file = fget(ctx->fd);
if (!file)
@@ -1570,14 +1574,9 @@ static int fuse_get_tree(struct fs_context *fsc)
{
struct fuse_fs_context *ctx = fsc->fs_private;
- if (!ctx->fd_present || !ctx->rootmode_present ||
- !ctx->user_id_present || !ctx->group_id_present)
- return -EINVAL;
-
-#ifdef CONFIG_BLOCK
- if (ctx->is_bdev)
+ if (IS_ENABLED(CONFIG_BLOCK) && ctx->is_bdev) {
return get_tree_bdev(fsc, fuse_fill_super);
-#endif
+ }
return get_tree_nodev(fsc, fuse_fill_super);
}