@@ -1587,6 +1587,19 @@ int fuse_bpf_file_write_iter(ssize_t *out, struct inode *inode, struct kiocb *io
iocb, from);
}
+long fuse_backing_ioctl(struct file *file, unsigned int command, unsigned long arg, int flags)
+{
+ struct fuse_file *ff = file->private_data;
+ long ret;
+
+ if (flags & FUSE_IOCTL_COMPAT)
+ ret = -ENOTTY;
+ else
+ ret = vfs_ioctl(ff->backing_file, command, arg);
+
+ return ret;
+}
+
int fuse_file_flock_backing(struct file *file, int cmd, struct file_lock *fl)
{
struct fuse_file *ff = file->private_data;
@@ -1651,6 +1651,8 @@ static inline int fuse_bpf_access(int *out, struct inode *inode, int mask)
#endif // CONFIG_FUSE_BPF
+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);
ssize_t fuse_backing_mmap(struct file *file, struct vm_area_struct *vma);
@@ -360,6 +360,15 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd,
if (fuse_is_bad(inode))
return -EIO;
+#ifdef CONFIG_FUSE_BPF
+ {
+ struct fuse_file *ff = file->private_data;
+
+ /* TODO - this is simply passthrough, not a proper BPF filter */
+ if (ff->backing_file)
+ return fuse_backing_ioctl(file, cmd, arg, flags);
+ }
+#endif
return fuse_do_ioctl(file, cmd, arg, flags);
}
This adds passthrough only support for ioctls with fuse-bpf. compat_ioctls will return -ENOTTY. Signed-off-by: Daniel Rosenberg <drosen@google.com> --- fs/fuse/backing.c | 13 +++++++++++++ fs/fuse/fuse_i.h | 2 ++ fs/fuse/ioctl.c | 9 +++++++++ 3 files changed, 24 insertions(+)