fuse: use exclusive lock when FUSE_I_CACHE_IO_MODE is set
authoryangyun <yangyun50@huawei.com>
Sat, 14 Sep 2024 08:51:31 +0000 (16:51 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 24 Sep 2024 11:21:33 +0000 (13:21 +0200)
This may be a typo. The comment has said shared locks are
not allowed when this bit is set. If using shared lock, the
wait in `fuse_file_cached_io_open` may be forever.

Fixes: 205c1d802683 ("fuse: allow parallel dio writes with FUSE_DIRECT_IO_ALLOW_MMAP")
CC: stable@vger.kernel.org # v6.9
Signed-off-by: yangyun <yangyun50@huawei.com>
Reviewed-by: Bernd Schubert <bschubert@ddn.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/file.c

index b8afeca12487062209a28fde1f78f0451191c3a2..1b5cd46c82250cea5daf1a5777e06efcc96d06b5 100644 (file)
@@ -1345,7 +1345,7 @@ static bool fuse_dio_wr_exclusive_lock(struct kiocb *iocb, struct iov_iter *from
 
        /* shared locks are not allowed with parallel page cache IO */
        if (test_bit(FUSE_I_CACHE_IO_MODE, &fi->state))
-               return false;
+               return true;
 
        /* Parallel dio beyond EOF is not supported, at least for now. */
        if (fuse_io_past_eof(iocb, from))