aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend/node_helpers.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2025-05-06 09:11:49 +0200
committerJakob Unterwurzacher2025-05-06 09:11:49 +0200
commit9b6e47fc0a2ed65d462424152a13f995a8d7dd9a (patch)
treedd3cdf0f52008f79f075df66a5f282de3b53c128 /internal/fusefrontend/node_helpers.go
parente59f97806b12d593b972bbd17988f061fcc09043 (diff)
Switch to the new atomic Uint64.Add apiHEADnew_atomicmaster
The new api guarantees that the value is aligned, preventing stuff like this on 32 bit platforms: goroutine 26 [running]: internal/runtime/atomic.panicUnaligned() /usr/lib/go-1.24/src/internal/runtime/atomic/unaligned.go:8 +0x24 internal/runtime/atomic.Xadd64(0x2496c74, 0x1) /usr/lib/go-1.24/src/internal/runtime/atomic/atomic_arm.s:318 +0x14 github.com/rfjakob/gocryptfs/internal/inomap.(*InoMap).NextSpillIno(0x2496c60) Fixes https://github.com/rfjakob/gocryptfs/issues/912
Diffstat (limited to 'internal/fusefrontend/node_helpers.go')
-rw-r--r--internal/fusefrontend/node_helpers.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/internal/fusefrontend/node_helpers.go b/internal/fusefrontend/node_helpers.go
index f5dfeb6..2ad2466 100644
--- a/internal/fusefrontend/node_helpers.go
+++ b/internal/fusefrontend/node_helpers.go
@@ -2,7 +2,6 @@ package fusefrontend
import (
"context"
- "sync/atomic"
"syscall"
"github.com/hanwen/go-fuse/v2/fs"
@@ -91,7 +90,7 @@ func (n *Node) newChild(ctx context.Context, st *syscall.Stat_t, out *fuse.Entry
if rn.args.SharedStorage || rn.quirks&syscallcompat.QuirkDuplicateIno1 != 0 {
// Make each directory entry a unique node by using a unique generation
// value - see the comment at RootNode.gen for details.
- gen = atomic.AddUint64(&rn.gen, 1)
+ gen = rn.gen.Add(1)
}
// Create child node