[PATCH v2 1/2] fuse: preserve FOPEN_PARALLEL_DIRECT_WRITES for passthrough opens
From: Russ Fellows
Date: Mon Jun 15 2026 - 21:45:28 EST
From: Russ Fellows <rfellows@xxxxxxxxxx>
fuse_file_io_open() currently strips FOPEN_PARALLEL_DIRECT_WRITES whenever FOPEN_DIRECT_IO is absent. That rule is correct for the regular direct-IO path, but it is too strict for passthrough opens.
Passthrough I/O already bypasses the page cache through the backing file, so it does not need FOPEN_DIRECT_IO to preserve direct-I/O semantics. Clearing the parallel-write flag for passthrough opens causes the kernel to drop the server's request for parallel direct writes before the passthrough write path ever sees it.
Keep FOPEN_PARALLEL_DIRECT_WRITES for opens that also carry FOPEN_PASSTHROUGH, and continue to clear it for non-passthrough opens that lack FOPEN_DIRECT_IO.
This is a prerequisite for passthrough write parallelism: without it, the subsequent shared-lock path never activates.
Signed-off-by: Russ Fellows <rfellows@xxxxxxxxxx>
---
fs/fuse/iomode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/iomode.c b/fs/fuse/iomode.c
index c99e285f3..0301a48d8 100644
--- a/fs/fuse/iomode.c
+++ b/fs/fuse/iomode.c
@@ -216,9 +216,12 @@ int fuse_file_io_open(struct file *file, struct inode *inode)
goto fail;
/*
- * FOPEN_PARALLEL_DIRECT_WRITES requires FOPEN_DIRECT_IO.
+ * FOPEN_PARALLEL_DIRECT_WRITES requires FOPEN_DIRECT_IO, except for
+ * passthrough opens which bypass the page cache regardless and do not
+ * need FOPEN_DIRECT_IO to guarantee direct I/O semantics.
*/
- if (!(ff->open_flags & FOPEN_DIRECT_IO))
+ if (!(ff->open_flags & FOPEN_DIRECT_IO) &&
+ !(ff->open_flags & FOPEN_PASSTHROUGH))
ff->open_flags &= ~FOPEN_PARALLEL_DIRECT_WRITES;
/*
--
2.51.0