Re: [PATCH v6] fuse: Add support for passthrough read/write

From: Miklos Szeredi
Date: Mon Aug 24 2020 - 08:48:19 EST


On Wed, Aug 19, 2020 at 11:25 AM Amir Goldstein <amir73il@xxxxxxxxx> wrote:

> > What I have in mind is things like not coupling the setup of the
> > passthrough fds to open(), but having a separate notification message for
> > this (like what we use for invalidation of cache), and adding not just
> > an "fd" field but also "offset" and "length" fields (which would
> > currently be required to be both zero to get the "full file" semantics).
> >
>
> You mean like this?
>
> https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/commit/?h=fuse2

Look specifically at fuse_file_map_iter():

https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/tree/fs/fuse2/file.c?h=fuse2#n582

and fudev_map_ioctl():

https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git/tree/fs/fuse2/fudev.c?h=fuse2#n601

This avoids the security issue Jann mentioned as well as allowing
arbitrary mapping of file ranges. E.g. it could also be used by a
block based filesystem to map I/O directly into the block device.

What the implementation lacks is any kind of caching. Since your
usecase involves just one map extent per file, special casing that
would be trivial. We can revisit general caching later.

Thanks,
Miklos