Revert "FROMLIST: fuse: Definitions and ioctl() for passthrough"

This reverts commit 314603f83d.

Change-Id: I0e6a6f7d990c2e442fd59ee30229858ad201cf63
Signed-off-by: Alessio Balsini <balsini@google.com>
This commit is contained in:
Alessio Balsini
2021-01-25 22:40:58 +00:00
parent 6ce9f3010f
commit 2cb79cc13a
8 changed files with 15 additions and 109 deletions

View File

@@ -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

View File

@@ -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 = {

View File

@@ -554,7 +554,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;
@@ -615,7 +614,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) {

View File

@@ -158,7 +158,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;
@@ -304,8 +304,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) {

View File

@@ -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;
@@ -767,9 +756,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;
@@ -813,12 +799,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;
};
/*
@@ -1234,10 +1214,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 */

View File

@@ -691,7 +691,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);
@@ -700,7 +699,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;
@@ -1054,12 +1052,6 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
fc->handle_killpriv_v2 = 1;
fm->sb->s_flags |= SB_NOSEC;
}
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;
@@ -1103,8 +1095,7 @@ void fuse_send_init(struct fuse_mount *fm)
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_HANDLE_KILLPRIV_V2 |
FUSE_PASSTHROUGH;
FUSE_HANDLE_KILLPRIV_V2;
#ifdef CONFIG_FUSE_DAX
if (fm->fc->dax)
ia->in.flags |= FUSE_MAP_ALIGNMENT;
@@ -1132,16 +1123,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);

View File

@@ -1,21 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
#include "fuse_i.h"
#include <linux/fuse.h>
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)
{
}

View File

@@ -626,7 +626,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 {
@@ -829,13 +829,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;
@@ -911,8 +904,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;