Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vaultfs): Fix 32-bit panic #720

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions vaultfs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ func newRefCountedClient(c *api.Client) *refCountedClient {
// other files are still open.
type refCountedClient struct {
*api.Client
refs uint64
refs atomic.Uint64
}

// var _ VaultClient = (*refCountedClient)(nil)

func (c *refCountedClient) AddRef() {
atomic.AddUint64(&c.refs, 1)
c.refs.Add(1)
}

func (c *refCountedClient) RemoveRef() {
Expand All @@ -36,9 +36,9 @@ func (c *refCountedClient) RemoveRef() {
}

// decrements the ref count by overflowing (see atomic.AddUint64 doc)
atomic.AddUint64(&c.refs, ^uint64(0))
c.refs.Add(^uint64(0))
}

func (c *refCountedClient) Refs() uint64 {
return atomic.LoadUint64(&c.refs)
return c.refs.Load()
}
Loading