aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/file_lock.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2024-12-30 12:08:41 +0100
committerJakob Unterwurzacher2024-12-30 12:08:41 +0100
commitb11aeec30866fe97b3c23488d51a47a040991b04 (patch)
tree3451f9ca376fd182fd8027326ee389eadc9090b3 /internal/fusefrontend/file_lock.go
parent8d2078b9cceaedd76a86f339165d0211cd78c8d9 (diff)
fusefrontend: sharedstorage: lock truncate agains concurrent accessLockSharedStorage_rebase1
Prevent reads and writes concurrent with the truncate operation. It's racy on tmpfs and ext4 ( https://lore.kernel.org/all/18e9fa0f-ec31-9107-459c-ae1694503f87@gmail.com/t/ ) as evident by TestOpenTruncate test failures: === RUN TestOpenTruncate cluster_test.go:209: POSIX compliance issue: non-exlusive create failed with err=file exists doRead 16384215: corrupt block #0: cipher: message authentication failed ino16384215 fh8: RMW read failed: errno=5 cluster_test.go:214: iteration 1: WriteAt: write /tmp/gocryptfs-test-parent-1026/1358464214/TestOpenTruncate.1788296708.mnt2/foo: input/output error --- FAIL: TestOpenTruncate (0.06s) FAIL exit status 1 FAIL github.com/rfjakob/gocryptfs/v2/tests/cluster 7.880s Relates-to: https://github.com/rfjakob/gocryptfs/issues/56
Diffstat (limited to 'internal/fusefrontend/file_lock.go')
-rw-r--r--internal/fusefrontend/file_lock.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/fusefrontend/file_lock.go b/internal/fusefrontend/file_lock.go
index 6f92cfe..bb72c52 100644
--- a/internal/fusefrontend/file_lock.go
+++ b/internal/fusefrontend/file_lock.go
@@ -6,7 +6,9 @@ import (
"github.com/rfjakob/gocryptfs/v2/internal/syscallcompat"
)
-// SharedStorageLock conveniently wraps F_OFD_SETLKW
+// SharedStorageLock conveniently wraps F_OFD_SETLKW.
+// It is a no-op unless args.SharedStorage is set.
+//
// See https://man7.org/linux/man-pages/man2/fcntl.2.html -> "Open file description locks (non-POSIX)"
//
// lkType is one of: