[Virtio-fs] [PATCH 3/4] fuse: Call vfs_get_tree() for submounts

Max Reitz mreitz at redhat.com
Thu May 27 13:24:40 UTC 2021


On 25.05.21 17:02, Greg Kurz wrote:
> We recently fixed an infinite loop by setting the SB_BORN flag on
> submounts along with the write barrier needed by super_cache_count().
> This is the job of vfs_get_tree() and FUSE shouldn't have to care
> about the barrier at all.
> 
> Split out some code from fuse_dentry_automount() to a new dedicated
> fuse_get_tree_submount() handler for submounts and call vfs_get_tree().
> 
> The fs_private field of the filesystem context isn't used with
> submounts : hijack it to pass the FUSE inode of the mount point
> down to fuse_get_tree_submount().

What exactly do you mean by “isn’t used”?  virtio_fs_init_fs_context() 
still sets it (it is non-NULL in fuse_dentry_automount() after 
fs_context_for_submount()).  It does appear like it is never read, but 
one thing that definitely would need to be done is for it to be freed 
before putting mp_fi there.

So I think it may technically be fine to use this field, but then 
virtio_fs_init_fs_context() shouldn’t set it for submounts (should be 
discernible with fsc->purpose), and perhaps that should be a separate patch.

(Apart from that, this patch looks good to me, though.)

Max

> Finally, adapt virtiofs to use this.
> 
> Signed-off-by: Greg Kurz <groug at kaod.org>
> ---
>   fs/fuse/dir.c       | 58 +++++++--------------------------------------
>   fs/fuse/fuse_i.h    |  6 +++++
>   fs/fuse/inode.c     | 44 ++++++++++++++++++++++++++++++++++
>   fs/fuse/virtio_fs.c |  3 +++
>   4 files changed, 62 insertions(+), 49 deletions(-)




More information about the Virtio-fs mailing list