On Wed, 29 Nov 2023 at 16:06, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > On Wed, Nov 29, 2023 at 4:14 PM Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > > > > On Wed, 29 Nov 2023 at 08:25, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > > > > > My proposed solution is to change the semantics with the init flag > > > FUSE_PASSTHROUGH to disallow mmap on FOPEN_DIRECT_IO > > > files. > > > > Why? FOPEN_DIRECT_IO and FUSE_PASSTHROUGH should mix much more > > readily than FOPEN_DIRECT_IO with page cache. > > > > Am I misunderstanding how mmap works with FOPEN_DIRECT_IO file? > My understanding is that mmap of FOPEN_DIRECT_IO reads/writes > from page cache of fuse inode. > > To clarify, the plan is to never allow mixing open of passthrough and > cached files on the same inode. Yep. But passthrough mmap + direct I/O should work, no? > It is allowed to open FOPEN_DIRECT_IO file for inode either in cached > or passthrough mode, but it is NOT allowed to mmap a FOPEN_DIRECT_IO > file for inode in passthrough mode. > > However, if inode only has file open in FOPEN_DIRECT_IO mode, then inode > mode is neutral. If we allow mmap in this state then a later open in passthourgh > mode and mmap in passthrough mode will collide with the direct mode mmap. We can keep track of when there are any page cache mmaps. Does that not solve this? > > Therefore, my proposal is than when filesystem is FUSE_PASSTHROUGH capable, > only passthrough file and cached file may be mmaped, but never allow to > mmap a FOPEN_DIRECT_IO file. > > Does that make sense? I'm not sure I understand how this is supposed to work. Disallowing mmap will break applications. Thanks, Miklos