From: Vivek Goyal <[email protected]> Sent: Monday, May 18, 2020 15:37 To: Fotis Xenakis <[email protected]> Cc: [email protected] <[email protected]>; [email protected] <[email protected]> Subject: Re: [Virtio-fs] [PATCH] Fix file descriptor passed for setupmapping
On Fri, May 15, 2020 at 04:50:31PM +0000, Fotis Xenakis wrote: > From: Liu Bo <[email protected]> > Sent: Friday, May 15, 2020 06:48 > To: Fotis Xenakis <[email protected]> > Cc: [email protected] <[email protected]> > Subject: Re: [Virtio-fs] [PATCH] Fix file descriptor passed for setupmapping > > On Wed, May 13, 2020 at 07:33:56PM +0300, Fotis Xenakis wrote: > > Currently, during FUSE_SETUPMAPPING, virtiofsd passes the wrong file > > descriptor for the file to mmap() to QEMU (specifically, it passes the > > file handle as requested from the guest). > > > > This fixes it, using lo_fi_fd() to map the file handle to the right file > > descriptor on the host. > > > > Looks good, guest has been setting fi as NULL though. > As far as I can see, this function is only called from [1], which passes fi > as NULL only when the file handle passed from the guest is (uint64_t)-1. In > my testing this was never the case though. Hi Fotis, Do you know what's different about your setup. This has been working for me so clearly I am seeing fi as NULL. Hello, This was on my mind as well: if others were affected by this bug, it wouldn't have gone unnoticed. Yet, I can't say I know what's different in my setup. Unfortunately, I have a less-than-basic understanding of virtiofsd, but as far as I can see: - virtiofsd differentiates on the file handler passed by the guest [1]. In my case fh != (uint64_t)-1 (which makes sense tbh). fh is whatever FUSE_OPEN returned. - Guest-side, the open() flags are passed through to FUSE_OPEN [2]. In my case that's O_RDONLY. - The only flag set for FUSE_INIT is FUSE_MAP_ALIGNMENT [3]. - For what it's worth, virtiofsd runs with "-o cache=always". References: [1] https://gitlab.com/virtio-fs/qemu/-/blob/21336c0f3d05a97f5c409bbc894c19d87259655c/tools/virtiofsd/fuse_lowlevel.c#L1910 [2] https://github.com/foxeng/osv/blob/46255086015a4c801baaf61d431e3aa7eda9e64b/fs/virtiofs/virtiofs_vnops.cc#L111 [3] https://github.com/foxeng/osv/blob/46255086015a4c801baaf61d431e3aa7eda9e64b/fs/virtiofs/virtiofs_vfsops.cc#L91 Vivek
_______________________________________________ Virtio-fs mailing list [email protected] https://www.redhat.com/mailman/listinfo/virtio-fs
