diff options
| author | Bernd Schubert <bschubert@ddn.com> | 2025-10-23 00:21:17 +0200 |
|---|---|---|
| committer | Miklos Szeredi <mszeredi@redhat.com> | 2025-11-13 14:54:05 +0100 |
| commit | b359af8275a982a458e8df6c6beab1415be1f795 (patch) | |
| tree | 6d92185aa8a9c813ccdd9954f47452100f92bea3 | |
| parent | 47781ee71fb6bf2e082580b98be72411b99b6e04 (diff) | |
fuse: Invalidate the page cache after FOPEN_DIRECT_IO write
generic_file_direct_write() also does this and has a large
comment about.
Reproducer here is xfstest's generic/209, which is exactly to
have competing DIO write and cached IO read.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
| -rw-r--r-- | fs/fuse/file.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 4d96e684d736..b60f394df5a3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1693,6 +1693,15 @@ ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, if (res > 0) *ppos = pos; + if (res > 0 && write && fopen_direct_io) { + /* + * As in generic_file_direct_write(), invalidate after the + * write, to invalidate read-ahead cache that may have competed + * with the write. + */ + invalidate_inode_pages2_range(mapping, idx_from, idx_to); + } + return res > 0 ? res : err; } EXPORT_SYMBOL_GPL(fuse_direct_io); |