Skip to content

Commit 3f29f1c

Browse files
amir73ilMiklos Szeredi
authored andcommitted
fuse: disable FOPEN_PARALLEL_DIRECT_WRITES with FUSE_DIRECT_IO_ALLOW_MMAP
The new fuse init flag FUSE_DIRECT_IO_ALLOW_MMAP breaks assumptions made by FOPEN_PARALLEL_DIRECT_WRITES and causes test generic/095 to hit BUG_ON(fi->writectr < 0) assertions in fuse_set_nowrite(): generic/095 5s ... kernel BUG at fs/fuse/dir.c:1756! ... ? fuse_set_nowrite+0x3d/0xdd ? do_raw_spin_unlock+0x88/0x8f ? _raw_spin_unlock+0x2d/0x43 ? fuse_range_is_writeback+0x71/0x84 fuse_sync_writes+0xf/0x19 fuse_direct_io+0x167/0x5bd fuse_direct_write_iter+0xf0/0x146 Auto disable FOPEN_PARALLEL_DIRECT_WRITES when server negotiated FUSE_DIRECT_IO_ALLOW_MMAP. Fixes: e78662e ("fuse: add a new fuse init flag to relax restrictions in no cache mode") Cc: <stable@vger.kernel.org> # v6.6 Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 7f8ed28 commit 3f29f1c

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/fuse/file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,13 +1574,15 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
15741574
ssize_t res;
15751575
bool exclusive_lock =
15761576
!(ff->open_flags & FOPEN_PARALLEL_DIRECT_WRITES) ||
1577+
get_fuse_conn(inode)->direct_io_allow_mmap ||
15771578
iocb->ki_flags & IOCB_APPEND ||
15781579
fuse_direct_write_extending_i_size(iocb, from);
15791580

15801581
/*
15811582
* Take exclusive lock if
15821583
* - Parallel direct writes are disabled - a user space decision
15831584
* - Parallel direct writes are enabled and i_size is being extended.
1585+
* - Shared mmap on direct_io file is supported (FUSE_DIRECT_IO_ALLOW_MMAP).
15841586
* This might not be needed at all, but needs further investigation.
15851587
*/
15861588
if (exclusive_lock)

0 commit comments

Comments
 (0)