diff --git a/fs/fuse/backing.c b/fs/fuse/backing.c index 041af4e0ab5b..b1694bdbb543 100644 --- a/fs/fuse/backing.c +++ b/fs/fuse/backing.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "../internal.h" @@ -988,6 +989,18 @@ void *fuse_file_write_iter_finalize(struct fuse_bpf_args *fa, return ERR_PTR(fwio->ret); } +ssize_t fuse_splice_read_backing(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, size_t len, unsigned long flags) +{ + struct fuse_file *ff = in->private_data; + ssize_t ret; + + ret = vfs_splice_read(ff->backing_file, ppos, pipe, len, flags); + fuse_file_accessed(in, ff->backing_file); + + return ret; +} + long fuse_backing_ioctl(struct file *file, unsigned int command, unsigned long arg, int flags) { struct fuse_file *ff = file->private_data; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2ea3592d758f..c0e06234144c 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1845,6 +1845,12 @@ static ssize_t fuse_splice_read(struct file *in, loff_t *ppos, { struct fuse_file *ff = in->private_data; +#ifdef CONFIG_FUSE_BPF + /* TODO - this is simply passthrough, not a proper BPF filter */ + if (ff->backing_file) + return fuse_splice_read_backing(in, ppos, pipe, len, flags); +#endif + /* FOPEN_DIRECT_IO overrides FOPEN_PASSTHROUGH */ if (fuse_file_passthrough(ff) && !(ff->open_flags & FOPEN_DIRECT_IO)) return fuse_passthrough_splice_read(in, ppos, pipe, len, flags); diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 21f25f826e75..21a120a6742e 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -1813,6 +1813,9 @@ int fuse_file_write_iter_backing(struct fuse_bpf_args *fa, void *fuse_file_write_iter_finalize(struct fuse_bpf_args *fa, struct kiocb *iocb, struct iov_iter *from); +ssize_t fuse_splice_read_backing(struct file *in, loff_t *ppos, + struct pipe_inode_info *pipe, size_t len, unsigned long flags); + long fuse_backing_ioctl(struct file *file, unsigned int command, unsigned long arg, int flags); int fuse_file_flock_backing(struct file *file, int cmd, struct file_lock *fl);