On 8/31/23 10:30, Hao Xu wrote:
On 8/30/23 00:11, Bernd Schubert wrote:
Take a shared lock in fuse_cache_write_iter. This was already
done for FOPEN_DIRECT_IO in
commit 153524053bbb ("fuse: allow non-extending parallel direct
writes on the same file")
but so far missing for plain O_DIRECT. Server side needs
to set FOPEN_PARALLEL_DIRECT_WRITES in order to signal that
it supports parallel dio writes.
Cc: Hao Xu <howeyxu@xxxxxxxxxxx>
Cc: Miklos Szeredi <miklos@xxxxxxxxxx>
Cc: Dharmendra Singh <dsingh@xxxxxxx>
Cc: linux-fsdevel@xxxxxxxxxxxxxxx
Signed-off-by: Bernd Schubert <bschubert@xxxxxxx>
---
fs/fuse/file.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6b8b9512c336..a6b99bc80fe7 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1314,6 +1314,10 @@ static bool fuse_dio_wr_exclusive_lock(struct
kiocb *iocb, struct iov_iter *from
struct file *file = iocb->ki_filp;
struct fuse_file *ff = file->private_data;
+ /* this function is about direct IO only */
+ if (!(iocb->ki_flags & IOCB_DIRECT))
+ return false;
This means for buffered write in fuse_cache_write_iter(), we grab shared
lock, looks not right.
Yeah, sorry, I made all values the other way around, consistently.
Miklos had already noticed.
Thanks,
Bernd