Skip to contentSkip to conversation

fuse: use exclusive lock when FUSE_I_CACHE_IO_MODE is set

PATCH Applied yangyun 3 participants 3 messages Sep 14, 2024 – Sep 24, 2024

Subsystems (2)
lore
Share & tools
lore

yangyun

author
#0 lore raw

PATCH 1/1 fuse: use exclusive lock when FUSE_I_CACHE_IO_MODE is set

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")
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +1 -1
index ca553d7a7c9e..e5f6affb0baa 100644
@@ -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))
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · yangyun

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")
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/fuse/file.c +0 -0
index ca553d7a7c9e..e5f6affb0baa 100644

fs/fuse/file.c static bool fuse_dio_wr_exclusive_lock(struct kiocb *iocb, struct iov_iter *from · line 1351

Quoted 8 lines
fs/fuse/file.c +1 -1
@@ -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))

Oh, another of these, maybe I should have named this function 'fuse_dio_deny_wr_shared_lock'. The good part is that it will be later on caught in fuse_dio_lock/fuse_inode_uncached_io_start and then switch to an exclusive lock. I.e. testing did not reveal it.

maintainer Applied
#2 lore raw
In reply to yangyun
Quoted 4 lines · yangyun

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.

Applied, thanks.

Miklos