From 6fc55d2f76066ab7c47952be0a3fb64888ac4037 Mon Sep 17 00:00:00 2001 From: Vaisakh Murali Date: Tue, 30 May 2023 18:45:31 +0600 Subject: [PATCH] [SQUASHED] Revert recent fuse commits Revert "ANDROID: fs/fuse: Keep FUSE file times consistent with lower file" This reverts commit a7bb2be7ae01a56020c5de32b29f2efaaa0d24e8. Revert "UPSTREAM: fuse: fix matching of FUSE_DEV_IOC_CLONE command" This reverts commit 1fe9a2c1b3e98fe7fe90a57ed5d40f75a91c4582. Revert "ANDROID: fuse/passthrough: API V2 with __u32 open argument" This reverts commit 3adc642f613c64af2cdf3365f62fe5947e348832. Revert "FROMLIST: fuse: Allocate unlikely used ioctl number for passthrough V1" This reverts commit 4291b8c86c2c6bec5b68a75a07698baa84a34a78. Revert "FROMLIST: fuse: Fix crediantials leak in passthrough read_iter" This reverts commit 6d5c23b5d8eaadb7f508915a431c213b0bb8acf1. Revert "FROMLIST: fuse: Introduce passthrough for mmap" This reverts commit b82fc9892a1f12df723bfb6db79b79400823872f. Revert "FROMLIST: fuse: Use daemon creds in passthrough mode" This reverts commit fc16aaea3b8f72a3ae298edd87da865775a201a1. Revert "FROMLIST: fuse: Handle asynchronous read and write in passthrough" This reverts commit 0e24815e19cf4be41ed7e7806787355999542e4c. Revert "FROMLIST: fuse: Introduce synchronous read and write for passthrough" This reverts commit 87aae7fd486f7de2f41e9e513a04c7b993c92008. Revert "FROMLIST: fuse: Passthrough initialization and release" This reverts commit dd54cebcc3c52af54bb78069d8f6fb8460eaa081. Revert "FROMLIST: fuse: Definitions and ioctl for passthrough" This reverts commit d3283a7fdec9eeae6367ab5e717f20ac2ae409cf. Revert "FROMLIST: fuse: 32-bit user space ioctl compat for fuse device" This reverts commit d792b60d3043d1045bd01e737a5812790d73f5f6. Revert "FROMLIST: fs: Generic function to convert iocb to rw flags" This reverts commit 778c932835b5b2d5cf7869f368f189063b86bfe5. --- fs/fuse/Makefile | 1 - fs/fuse/dev.c | 39 ++--- fs/fuse/dir.c | 1 - fs/fuse/file.c | 15 +- fs/fuse/fuse_i.h | 32 ---- fs/fuse/inode.c | 23 +-- fs/fuse/passthrough.c | 305 -------------------------------------- fs/overlayfs/file.c | 23 ++- include/uapi/linux/fuse.h | 9 +- 9 files changed, 38 insertions(+), 410 deletions(-) delete mode 100644 fs/fuse/passthrough.c diff --git a/fs/fuse/Makefile b/fs/fuse/Makefile index 6971454a2bdf..3e8cebfb59b7 100644 --- a/fs/fuse/Makefile +++ b/fs/fuse/Makefile @@ -8,5 +8,4 @@ obj-$(CONFIG_CUSE) += cuse.o obj-$(CONFIG_VIRTIO_FS) += virtiofs.o fuse-objs := dev.o dir.o file.o inode.o control.o xattr.o acl.o readdir.o -fuse-objs += passthrough.o virtiofs-y += virtio_fs.o diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index d1cae08ba1cb..f745cd644c1b 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2266,50 +2266,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 = NULL; - - switch (cmd) { - case FUSE_DEV_IOC_CLONE: - res = -EFAULT; - if (!get_user(oldfd, (__u32 __user *)arg)) { + int err = -ENOTTY; + + 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) { + 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 (!get_user(oldfd, (__u32 __user *)arg)) { - res = -EINVAL; - fud = fuse_get_dev(file); - if (fud) - res = fuse_passthrough_open(fud, oldfd); - } - 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 cc4ef56d4dd9..bae0ce5b6aec 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -529,7 +529,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 fe050b9609c9..74e8fdc85f82 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -151,7 +151,7 @@ int fuse_do_open(struct fuse_conn *fc, 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; @@ -287,8 +287,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) { @@ -1598,9 +1596,7 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to) if (fuse_is_bad(file_inode(file))) return -EIO; - if (ff->passthrough.filp) - return fuse_passthrough_read_iter(iocb, to); - else if (!(ff->open_flags & FOPEN_DIRECT_IO)) + if (!(ff->open_flags & FOPEN_DIRECT_IO)) return fuse_cache_read_iter(iocb, to); else return fuse_direct_read_iter(iocb, to); @@ -1614,9 +1610,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from) if (fuse_is_bad(file_inode(file))) return -EIO; - if (ff->passthrough.filp) - return fuse_passthrough_write_iter(iocb, from); - else if (!(ff->open_flags & FOPEN_DIRECT_IO)) + if (!(ff->open_flags & FOPEN_DIRECT_IO)) return fuse_cache_write_iter(iocb, from); else return fuse_direct_write_iter(iocb, from); @@ -2330,9 +2324,6 @@ static int fuse_file_mmap(struct file *file, struct vm_area_struct *vma) { struct fuse_file *ff = file->private_data; - if (ff->passthrough.filp) - return fuse_passthrough_mmap(file, vma); - if (ff->open_flags & FOPEN_DIRECT_IO) { /* Can't provide the coherency needed for MAP_SHARED */ if (vma->vm_flags & VM_MAYSHARE) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index cbee6796cec5..2d9aaf31e01f 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -165,17 +165,6 @@ enum { struct fuse_conn; struct fuse_release_args; -/** - * Reference to lower filesystem file for read/write operations handled in - * passthrough mode. - * This struct also tracks the credentials to be used for handling read/write - * operations. - */ -struct fuse_passthrough { - struct file *filp; - struct cred *cred; -}; - /** FUSE specific file data */ struct fuse_file { /** Fuse connection for this file */ @@ -221,9 +210,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; @@ -740,9 +726,6 @@ struct fuse_conn { /* Do not show mount options */ unsigned int no_mount_options:1; - /** Passthrough mode for read/write IO */ - unsigned int passthrough:1; - /** The number of requests waiting for completion */ atomic_t num_waiting; @@ -778,12 +761,6 @@ struct fuse_conn { /** List of device instances belonging to this connection */ struct list_head devices; - - /** IDR for passthrough requests */ - struct idr passthrough_req; - - /** Protects passthrough_req */ - spinlock_t passthrough_req_lock; }; static inline struct fuse_conn *get_fuse_conn_super(struct super_block *sb) @@ -1134,13 +1111,4 @@ unsigned int fuse_len_args(unsigned int numargs, struct fuse_arg *args); u64 fuse_get_unique(struct fuse_iqueue *fiq); void fuse_free_conn(struct fuse_conn *fc); -/* passthrough.c */ -int fuse_passthrough_open(struct fuse_dev *fud, u32 lower_fd); -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); -ssize_t fuse_passthrough_read_iter(struct kiocb *iocb, struct iov_iter *to); -ssize_t fuse_passthrough_write_iter(struct kiocb *iocb, struct iov_iter *from); -ssize_t fuse_passthrough_mmap(struct file *file, struct vm_area_struct *vma); - #endif /* _FS_FUSE_I_H */ diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 1c982cd43537..f3d712decb57 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -628,7 +628,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns, 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); @@ -637,7 +636,6 @@ void fuse_conn_init(struct fuse_conn *fc, struct user_namespace *user_ns, 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; @@ -974,12 +972,6 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_args *args, min_t(unsigned int, FUSE_MAX_MAX_PAGES, max_t(unsigned int, arg->max_pages, 1)); } - if (arg->flags & FUSE_PASSTHROUGH) { - fc->passthrough = 1; - /* Prevent further stacking */ - fc->sb->s_stack_depth = - FILESYSTEM_MAX_STACK_DEPTH; - } } else { ra_pages = fc->max_read / PAGE_SIZE; fc->no_lock = 1; @@ -1017,8 +1009,7 @@ void fuse_send_init(struct fuse_conn *fc) 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; ia->args.opcode = FUSE_INIT; ia->args.in_numargs = 1; ia->args.in_args[0].size = sizeof(ia->in); @@ -1039,21 +1030,9 @@ void fuse_send_init(struct fuse_conn *fc) } EXPORT_SYMBOL_GPL(fuse_send_init); -static int free_fuse_passthrough(int id, void *p, void *data) -{ - struct fuse_passthrough *passthrough = (struct fuse_passthrough *)p; - - fuse_passthrough_release(passthrough); - kfree(p); - - 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 95368ddfb53a..000000000000 --- a/fs/fuse/passthrough.c +++ /dev/null @@ -1,305 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include "fuse_i.h" - -#include -#include -#include - -#define PASSTHROUGH_IOCB_MASK \ - (IOCB_APPEND | IOCB_DSYNC | IOCB_HIPRI | IOCB_NOWAIT | IOCB_SYNC) - -struct fuse_aio_req { - struct kiocb iocb; - struct kiocb *iocb_fuse; -}; - -static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, - struct file *filp) -{ - *kiocb = (struct kiocb){ - .ki_filp = filp, - .ki_flags = kiocb_src->ki_flags, - .ki_hint = kiocb_src->ki_hint, - .ki_ioprio = kiocb_src->ki_ioprio, - .ki_pos = kiocb_src->ki_pos, - }; -} - -static void fuse_file_accessed(struct file *dst_file, struct file *src_file) -{ - struct inode *dst_inode; - struct inode *src_inode; - - if (dst_file->f_flags & O_NOATIME) - return; - - dst_inode = file_inode(dst_file); - src_inode = file_inode(src_file); - - if ((!timespec64_equal(&dst_inode->i_mtime, &src_inode->i_mtime) || - !timespec64_equal(&dst_inode->i_ctime, &src_inode->i_ctime))) { - dst_inode->i_mtime = src_inode->i_mtime; - dst_inode->i_ctime = src_inode->i_ctime; - } - - touch_atime(&dst_file->f_path); -} - -static void fuse_copyattr(struct file *dst_file, struct file *src_file) -{ - struct inode *dst = file_inode(dst_file); - struct inode *src = file_inode(src_file); - - dst->i_atime = src->i_atime; - dst->i_mtime = src->i_mtime; - dst->i_ctime = src->i_ctime; - i_size_write(dst, i_size_read(src)); -} - -static void fuse_aio_cleanup_handler(struct fuse_aio_req *aio_req) -{ - struct kiocb *iocb = &aio_req->iocb; - struct kiocb *iocb_fuse = aio_req->iocb_fuse; - - if (iocb->ki_flags & IOCB_WRITE) { - __sb_writers_acquired(file_inode(iocb->ki_filp)->i_sb, - SB_FREEZE_WRITE); - file_end_write(iocb->ki_filp); - fuse_copyattr(iocb_fuse->ki_filp, iocb->ki_filp); - } - - iocb_fuse->ki_pos = iocb->ki_pos; - kfree(aio_req); -} - -static void fuse_aio_rw_complete(struct kiocb *iocb, long res, long res2) -{ - struct fuse_aio_req *aio_req = - container_of(iocb, struct fuse_aio_req, iocb); - struct kiocb *iocb_fuse = aio_req->iocb_fuse; - - fuse_aio_cleanup_handler(aio_req); - iocb_fuse->ki_complete(iocb_fuse, res, res2); -} - -ssize_t fuse_passthrough_read_iter(struct kiocb *iocb_fuse, - struct iov_iter *iter) -{ - ssize_t ret; - const struct cred *old_cred; - struct file *fuse_filp = iocb_fuse->ki_filp; - struct fuse_file *ff = fuse_filp->private_data; - struct file *passthrough_filp = ff->passthrough.filp; - - if (!iov_iter_count(iter)) - return 0; - - old_cred = override_creds(ff->passthrough.cred); - if (is_sync_kiocb(iocb_fuse)) { - ret = vfs_iter_read(passthrough_filp, iter, &iocb_fuse->ki_pos, - iocb_to_rw_flags(iocb_fuse->ki_flags, - PASSTHROUGH_IOCB_MASK)); - } else { - struct fuse_aio_req *aio_req; - - aio_req = kmalloc(sizeof(struct fuse_aio_req), GFP_KERNEL); - if (!aio_req) { - ret = -ENOMEM; - goto out; - } - - aio_req->iocb_fuse = iocb_fuse; - kiocb_clone(&aio_req->iocb, iocb_fuse, passthrough_filp); - aio_req->iocb.ki_complete = fuse_aio_rw_complete; - ret = call_read_iter(passthrough_filp, &aio_req->iocb, iter); - if (ret != -EIOCBQUEUED) - fuse_aio_cleanup_handler(aio_req); - } -out: - revert_creds(old_cred); - - fuse_file_accessed(fuse_filp, passthrough_filp); - - return ret; -} - -ssize_t fuse_passthrough_write_iter(struct kiocb *iocb_fuse, - struct iov_iter *iter) -{ - ssize_t ret; - const struct cred *old_cred; - struct file *fuse_filp = iocb_fuse->ki_filp; - struct fuse_file *ff = fuse_filp->private_data; - struct inode *fuse_inode = file_inode(fuse_filp); - struct file *passthrough_filp = ff->passthrough.filp; - struct inode *passthrough_inode = file_inode(passthrough_filp); - - if (!iov_iter_count(iter)) - return 0; - - inode_lock(fuse_inode); - - fuse_copyattr(fuse_filp, passthrough_filp); - - old_cred = override_creds(ff->passthrough.cred); - if (is_sync_kiocb(iocb_fuse)) { - file_start_write(passthrough_filp); - ret = vfs_iter_write(passthrough_filp, iter, &iocb_fuse->ki_pos, - iocb_to_rw_flags(iocb_fuse->ki_flags, - PASSTHROUGH_IOCB_MASK)); - file_end_write(passthrough_filp); - if (ret > 0) - fuse_copyattr(fuse_filp, passthrough_filp); - } else { - struct fuse_aio_req *aio_req; - - aio_req = kmalloc(sizeof(struct fuse_aio_req), GFP_KERNEL); - if (!aio_req) { - ret = -ENOMEM; - goto out; - } - - file_start_write(passthrough_filp); - __sb_writers_release(passthrough_inode->i_sb, SB_FREEZE_WRITE); - - aio_req->iocb_fuse = iocb_fuse; - kiocb_clone(&aio_req->iocb, iocb_fuse, passthrough_filp); - aio_req->iocb.ki_complete = fuse_aio_rw_complete; - ret = call_write_iter(passthrough_filp, &aio_req->iocb, iter); - if (ret != -EIOCBQUEUED) - fuse_aio_cleanup_handler(aio_req); - } -out: - revert_creds(old_cred); - inode_unlock(fuse_inode); - - return ret; -} - -ssize_t fuse_passthrough_mmap(struct file *file, struct vm_area_struct *vma) -{ - int ret; - const struct cred *old_cred; - struct fuse_file *ff = file->private_data; - struct file *passthrough_filp = ff->passthrough.filp; - - if (!passthrough_filp->f_op->mmap) - return -ENODEV; - - if (WARN_ON(file != vma->vm_file)) - return -EIO; - - vma->vm_file = get_file(passthrough_filp); - - old_cred = override_creds(ff->passthrough.cred); - ret = call_mmap(vma->vm_file, vma); - revert_creds(old_cred); - - if (ret) - fput(passthrough_filp); - else - fput(file); - - fuse_file_accessed(file, passthrough_filp); - - return ret; -} - -int fuse_passthrough_open(struct fuse_dev *fud, u32 lower_fd) -{ - int res; - struct file *passthrough_filp; - struct fuse_conn *fc = fud->fc; - struct inode *passthrough_inode; - struct super_block *passthrough_sb; - struct fuse_passthrough *passthrough; - - if (!fc->passthrough) - return -EPERM; - - passthrough_filp = fget(lower_fd); - if (!passthrough_filp) { - pr_err("FUSE: invalid file descriptor for passthrough.\n"); - return -EBADF; - } - - if (!passthrough_filp->f_op->read_iter || - !passthrough_filp->f_op->write_iter) { - pr_err("FUSE: passthrough file misses file operations.\n"); - res = -EBADF; - goto err_free_file; - } - - passthrough_inode = file_inode(passthrough_filp); - passthrough_sb = passthrough_inode->i_sb; - if (passthrough_sb->s_stack_depth >= FILESYSTEM_MAX_STACK_DEPTH) { - pr_err("FUSE: fs stacking depth exceeded for passthrough\n"); - res = -EINVAL; - goto err_free_file; - } - - passthrough = kmalloc(sizeof(struct fuse_passthrough), GFP_KERNEL); - if (!passthrough) { - res = -ENOMEM; - goto err_free_file; - } - - passthrough->filp = passthrough_filp; - passthrough->cred = prepare_creds(); - - idr_preload(GFP_KERNEL); - spin_lock(&fc->passthrough_req_lock); - res = idr_alloc(&fc->passthrough_req, passthrough, 1, 0, GFP_ATOMIC); - spin_unlock(&fc->passthrough_req_lock); - idr_preload_end(); - - if (res > 0) - return res; - - fuse_passthrough_release(passthrough); - kfree(passthrough); - -err_free_file: - fput(passthrough_filp); - - return res; -} - -int fuse_passthrough_setup(struct fuse_conn *fc, struct fuse_file *ff, - struct fuse_open_out *openarg) -{ - struct fuse_passthrough *passthrough; - int passthrough_fh = openarg->passthrough_fh; - - if (!fc->passthrough) - return -EPERM; - - /* Default case, passthrough is not requested */ - if (passthrough_fh <= 0) - return -EINVAL; - - spin_lock(&fc->passthrough_req_lock); - passthrough = idr_remove(&fc->passthrough_req, passthrough_fh); - spin_unlock(&fc->passthrough_req_lock); - - if (!passthrough) - return -EINVAL; - - ff->passthrough = *passthrough; - kfree(passthrough); - - return 0; -} - -void fuse_passthrough_release(struct fuse_passthrough *passthrough) -{ - if (passthrough->filp) { - fput(passthrough->filp); - passthrough->filp = NULL; - } - if (passthrough->cred) { - put_cred(passthrough->cred); - passthrough->cred = NULL; - } -} diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c index f59638448d55..d27bc5f9face 100644 --- a/fs/overlayfs/file.c +++ b/fs/overlayfs/file.c @@ -14,8 +14,6 @@ #include #include "overlayfs.h" -#define OVL_IOCB_MASK (IOCB_DSYNC | IOCB_HIPRI | IOCB_NOWAIT | IOCB_SYNC) - static char ovl_whatisit(struct inode *inode, struct inode *realinode) { if (realinode != ovl_inode_upper(inode)) @@ -215,6 +213,23 @@ static void ovl_file_accessed(struct file *file) touch_atime(&file->f_path); } +static rwf_t ovl_iocb_to_rwf(struct kiocb *iocb) +{ + int ifl = iocb->ki_flags; + rwf_t flags = 0; + + if (ifl & IOCB_NOWAIT) + flags |= RWF_NOWAIT; + if (ifl & IOCB_HIPRI) + flags |= RWF_HIPRI; + if (ifl & IOCB_DSYNC) + flags |= RWF_DSYNC; + if (ifl & IOCB_SYNC) + flags |= RWF_SYNC; + + return flags; +} + static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) { struct file *file = iocb->ki_filp; @@ -231,7 +246,7 @@ static ssize_t ovl_read_iter(struct kiocb *iocb, struct iov_iter *iter) old_cred = ovl_override_creds(file_inode(file)->i_sb); ret = vfs_iter_read(real.file, iter, &iocb->ki_pos, - iocb_to_rw_flags(iocb->ki_flags, OVL_IOCB_MASK)); + ovl_iocb_to_rwf(iocb)); ovl_revert_creds(file_inode(file)->i_sb, old_cred); ovl_file_accessed(file); @@ -266,7 +281,7 @@ static ssize_t ovl_write_iter(struct kiocb *iocb, struct iov_iter *iter) old_cred = ovl_override_creds(file_inode(file)->i_sb); file_start_write(real.file); ret = vfs_iter_write(real.file, iter, &iocb->ki_pos, - iocb_to_rw_flags(iocb->ki_flags, OVL_IOCB_MASK)); + ovl_iocb_to_rwf(iocb)); file_end_write(real.file); ovl_revert_creds(file_inode(file)->i_sb, old_cred); diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index a62498fbad3e..0a88b2179fda 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h @@ -342,7 +342,6 @@ struct fuse_file_lock { #define FUSE_NO_OPENDIR_SUPPORT (1 << 24) #define FUSE_EXPLICIT_INVAL_DATA (1 << 25) #define FUSE_MAP_ALIGNMENT (1 << 26) -#define FUSE_PASSTHROUGH (1 << 31) /** * CUSE INIT request/reply flags @@ -593,7 +592,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 { @@ -871,11 +870,7 @@ struct fuse_notify_retrieve_in { }; /* Device ioctls: */ -#define FUSE_DEV_IOC_MAGIC 229 -#define FUSE_DEV_IOC_CLONE _IOR(FUSE_DEV_IOC_MAGIC, 0, uint32_t) -/* 127 is reserved for the V1 interface implementation in Android (deprecated) */ -/* 126 is reserved for the V2 interface implementation in Android */ -#define FUSE_DEV_IOC_PASSTHROUGH_OPEN _IOW(FUSE_DEV_IOC_MAGIC, 126, __u32) +#define FUSE_DEV_IOC_CLONE _IOR(229, 0, uint32_t) struct fuse_lseek_in { uint64_t fh;