On Thu, 8 Feb 2024 at 18:09, Amir Goldstein <amir73il@xxxxxxxxx> wrote: > We use an internal FOPEN_CACHE_IO flag to mark a file that was open in > caching mode. This flag can not be set by the server. > > direct_io mmap uses page cache, so first mmap will mark the file as > FOPEN_DIRECT_IO|FOPEN_CACHE_IO (i.e. mixed mode) and inode will enter > the caching io mode. I think using FOPEN_CACHE_IO for this is wrong. Why not just an internal flag? > +/* No more pending io and no new io possible to inode via open/mmapped file */ > +void fuse_file_io_release(struct fuse_file *ff, struct inode *inode) > +{ > + if (!ff->io_opened) > + return; > + > + /* Last caching file close exits caching inode io mode */ > + if (ff->open_flags & FOPEN_CACHE_IO) > + fuse_file_cached_io_end(inode); The above is the only place where io_opened is checked without a WARN_ON. So can't this be incorporated into the flag indicating whether caching is on? Thanks, Miklos