From 95209e20aeb894eb2cfab6781b4a370370424649 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Mon, 25 Jan 2021 22:39:09 +0000 Subject: [PATCH] Revert "FROMLIST: fuse: Definitions and ioctl() for passthrough" This reverts commit 314603f83de1e7f5dd8ea6294326c54b44762be8. Change-Id: I7c5d8406e1e5c61f8d804bfc68eaea140d7a0c1e Signed-off-by: Alessio Balsini --- fs/fuse/Makefile | 1 - fs/fuse/dev.c | 40 +++++++++++---------------------------- fs/fuse/dir.c | 2 -- fs/fuse/file.c | 4 +--- fs/fuse/fuse_i.h | 26 ------------------------- fs/fuse/inode.c | 18 +----------------- fs/fuse/passthrough.c | 21 -------------------- include/uapi/linux/fuse.h | 13 ++----------- 8 files changed, 15 insertions(+), 110 deletions(-) delete mode 100644 fs/fuse/passthrough.c diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile index 20ed23aa16fa..8c7021fb2cd4 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_CUSE) += cuse.o obj-$(CONFIG_VIRTIO_FS) += virtiofs.o fuse-y := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o -fuse-y += passthrough.o fuse-$(CONFIG_FUSE_DAX) += dax.o virtiofs-y := virtio_fs.o diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index d3908653e3ed..1d635356b1b9 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2242,55 +2242,37 @@ static int fuse_device_clone(struct fuse_conn *fc, struct file *new) static long fuse_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - int res; - int oldfd; - struct fuse_dev *fud; - struct fuse_passthrough_out pto; + int err = -ENOTTY; - switch (cmd) { - case FUSE_DEV_IOC_CLONE: - res = -EFAULT; - if (!get_user(oldfd, (__u32 __user *)arg)) { + if (cmd == FUSE_DEV_IOC_CLONE) { + int oldfd; + + err = -EFAULT; + if (!get_user(oldfd, (__u32 __user *) arg)) { struct file *old = fget(oldfd); - res = -EINVAL; + err = -EINVAL; if (old) { - fud = NULL; + struct fuse_dev *fud = NULL; /* * Check against file->f_op because CUSE * uses the same ioctl handler. */ if (old->f_op == file->f_op && - old->f_cred->user_ns == - file->f_cred->user_ns) + old->f_cred->user_ns == file->f_cred->user_ns) fud = fuse_get_dev(old); if (fud) { mutex_lock(&fuse_mutex); - res = fuse_device_clone(fud->fc, file); + err = fuse_device_clone(fud->fc, file); mutex_unlock(&fuse_mutex); } fput(old); } } - break; - case FUSE_DEV_IOC_PASSTHROUGH_OPEN: - res = -EFAULT; - if (!copy_from_user(&pto, - (struct fuse_passthrough_out __user *)arg, - sizeof(pto))) { - res = -EINVAL; - fud = fuse_get_dev(file); - if (fud) - res = fuse_passthrough_open(fud, &pto); - } - break; - default: - res = -ENOTTY; - break; } - return res; + return err; } const struct file_operations fuse_dev_operations = { diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index f058dd171eec..0be427da8464 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -555,7 +555,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int err; struct inode *inode; struct fuse_mount *fm = get_fuse_mount(dir); - struct fuse_conn *fc = get_fuse_conn(dir); FUSE_ARGS(args); struct fuse_forget_link *forget; struct fuse_create_in inarg; @@ -610,7 +609,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, ff->fh = outopen.fh; ff->nodeid = outentry.nodeid; ff->open_flags = outopen.open_flags; - fuse_passthrough_setup(fc, ff, &outopen); inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, &outentry.attr, entry_attr_timeout(&outentry), 0); if (!inode) { diff --git a/fs/fuse/file.c b/fs/fuse/file.c index eb1c34473e3d..8b306005453c 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -152,7 +152,7 @@ int fuse_do_open(struct fuse_mount *fm, u64 nodeid, struct file *file, if (!err) { ff->fh = outarg.fh; ff->open_flags = outarg.open_flags; - fuse_passthrough_setup(fc, ff, &outarg); + } else if (err != -ENOSYS) { fuse_file_free(ff); return err; @@ -298,8 +298,6 @@ void fuse_release_common(struct file *file, bool isdir) struct fuse_release_args *ra = ff->release_args; int opcode = isdir ? FUSE_RELEASEDIR : FUSE_RELEASE; - fuse_passthrough_release(&ff->passthrough); - fuse_prepare_release(fi, ff, file->f_flags, opcode); if (ff->flock) { diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 863b1082e44d..ba9ccf010c3b 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -180,14 +180,6 @@ struct fuse_conn; struct fuse_mount; struct fuse_release_args; -/** - * Reference to lower filesystem file for read/write operations handled in - * passthrough mode - */ -struct fuse_passthrough { - struct file *filp; -}; - /** FUSE specific file data */ struct fuse_file { /** Fuse connection for this file */ @@ -233,9 +225,6 @@ struct fuse_file { } readdir; - /** Container for data related to the passthrough functionality */ - struct fuse_passthrough passthrough; - /** RB node to be linked on fuse_conn->polled_files */ struct rb_node polled_node; @@ -759,9 +748,6 @@ struct fuse_conn { /* Auto-mount submounts announced by the server */ unsigned int auto_submounts:1; - /** Passthrough mode for read/write IO */ - unsigned int passthrough:1; - /** The number of requests waiting for completion */ atomic_t num_waiting; @@ -805,12 +791,6 @@ struct fuse_conn { /** List of filesystems using this connection */ struct list_head mounts; - - /** IDR for passthrough requests */ - struct idr passthrough_req; - - /** Protects passthrough_req */ - spinlock_t passthrough_req_lock; }; /* @@ -1243,10 +1223,4 @@ void fuse_dax_inode_cleanup(struct inode *inode); bool fuse_dax_check_alignment(struct fuse_conn *fc, unsigned int map_alignment); void fuse_dax_cancel_work(struct fuse_conn *fc); -int fuse_passthrough_open(struct fuse_dev *fud, - struct fuse_passthrough_out *pto); -int fuse_passthrough_setup(struct fuse_conn *fc, struct fuse_file *ff, - struct fuse_open_out *openarg); -void fuse_passthrough_release(struct fuse_passthrough *passthrough); - #endif /* _FS_FUSE_I_H */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 14d2887193c6..f94b0bb57619 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -680,7 +680,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm, memset(fc, 0, sizeof(*fc)); spin_lock_init(&fc->lock); spin_lock_init(&fc->bg_lock); - spin_lock_init(&fc->passthrough_req_lock); init_rwsem(&fc->killsb); refcount_set(&fc->count, 1); atomic_set(&fc->dev_count, 1); @@ -689,7 +688,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct fuse_mount *fm, INIT_LIST_HEAD(&fc->bg_queue); INIT_LIST_HEAD(&fc->entry); INIT_LIST_HEAD(&fc->devices); - idr_init(&fc->passthrough_req); atomic_set(&fc->num_waiting, 0); fc->max_background = FUSE_DEFAULT_MAX_BACKGROUND; fc->congestion_threshold = FUSE_DEFAULT_CONGESTION_THRESHOLD; @@ -1057,12 +1055,6 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args, !fuse_dax_check_alignment(fc, arg->map_alignment)) { ok = false; } - if (arg->flags & FUSE_PASSTHROUGH) { - fc->passthrough = 1; - /* Prevent further stacking */ - fm->sb->s_stack_depth = - FILESYSTEM_MAX_STACK_DEPTH; - } } else { ra_pages = fc->max_read / PAGE_SIZE; fc->no_lock = 1; @@ -1105,8 +1097,7 @@ void fuse_send_init(struct fuse_mount *fm) FUSE_WRITEBACK_CACHE | FUSE_NO_OPEN_SUPPORT | FUSE_PARALLEL_DIROPS | FUSE_HANDLE_KILLPRIV | FUSE_POSIX_ACL | FUSE_ABORT_ERROR | FUSE_MAX_PAGES | FUSE_CACHE_SYMLINKS | - FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA | - FUSE_PASSTHROUGH; + FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA; #ifdef CONFIG_FUSE_DAX if (fm->fc->dax) ia->in.flags |= FUSE_MAP_ALIGNMENT; @@ -1134,16 +1125,9 @@ void fuse_send_init(struct fuse_mount *fm) } EXPORT_SYMBOL_GPL(fuse_send_init); -static int free_fuse_passthrough(int id, void *p, void *data) -{ - return 0; -} - void fuse_free_conn(struct fuse_conn *fc) { WARN_ON(!list_empty(&fc->devices)); - idr_for_each(&fc->passthrough_req, free_fuse_passthrough, NULL); - idr_destroy(&fc->passthrough_req); kfree_rcu(fc, rcu); } EXPORT_SYMBOL_GPL(fuse_free_conn); diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c deleted file mode 100644 index 594060c654f8..000000000000 --- a/fs/fuse/passthrough.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include "fuse_i.h" - -#include - -int fuse_passthrough_open(struct fuse_dev *fud, - struct fuse_passthrough_out *pto) -{ - return -EINVAL; -} - -int fuse_passthrough_setup(struct fuse_conn *fc, struct fuse_file *ff, - struct fuse_open_out *openarg) -{ - return -EINVAL; -} - -void fuse_passthrough_release(struct fuse_passthrough *passthrough) -{ -} diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index ad0ba7bc416d..6de4fbadb1b8 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -349,7 +349,6 @@ struct fuse_file_lock { #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) #define FUSE_MAP_ALIGNMENT (1 << 26) #define FUSE_SUBMOUNTS (1 << 27) -#define FUSE_PASSTHROUGH (1 << 28) /** * CUSE INIT request/reply flags @@ -607,7 +606,7 @@ struct fuse_create_in { struct fuse_open_out { uint64_t fh; uint32_t open_flags; - uint32_t passthrough_fh; + uint32_t padding; }; struct fuse_release_in { @@ -810,13 +809,6 @@ struct fuse_in_header { uint32_t padding; }; -struct fuse_passthrough_out { - uint32_t fd; - /* For future implementation */ - uint32_t len; - void *vec; -}; - struct fuse_out_header { uint32_t len; int32_t error; @@ -892,8 +884,7 @@ struct fuse_notify_retrieve_in { }; /* Device ioctls: */ -#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) -#define FUSE_DEV_IOC_PASSTHROUGH_OPEN _IOW(229, 1, struct fuse_passthrough_out) +#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) struct fuse_lseek_in { uint64_t fh;