mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Remove argument from vfs.MountNamespace.DecRef()
Updates #1035 PiperOrigin-RevId: 293194631
This commit is contained in:
committed by
gVisor bot
parent
492229d017
commit
dcffddf0ca
@@ -86,7 +86,7 @@ func NewAccessor(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth
|
||||
// Release must be called when a is no longer in use.
|
||||
func (a *Accessor) Release() {
|
||||
a.root.DecRef()
|
||||
a.mntns.DecRef(a.vfsObj)
|
||||
a.mntns.DecRef()
|
||||
}
|
||||
|
||||
// accessorContext implements context.Context by extending an existing
|
||||
|
||||
@@ -45,7 +45,7 @@ func TestDevtmpfs(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tmpfs root mount: %v", err)
|
||||
}
|
||||
defer mntns.DecRef(vfsObj)
|
||||
defer mntns.DecRef()
|
||||
root := mntns.Root()
|
||||
defer root.DecRef()
|
||||
devpop := vfs.PathOperation{
|
||||
|
||||
@@ -98,7 +98,7 @@ func (s *System) WithTemporaryContext(ctx context.Context) *System {
|
||||
// Destroy release resources associated with a test system.
|
||||
func (s *System) Destroy() {
|
||||
s.Root.DecRef()
|
||||
s.mns.DecRef(s.VFS) // Reference on mns passed to NewSystem.
|
||||
s.mns.DecRef() // Reference on mns passed to NewSystem.
|
||||
}
|
||||
|
||||
// ReadToEnd reads the contents of fd until EOF to a string.
|
||||
|
||||
@@ -183,7 +183,7 @@ func BenchmarkVFS2MemfsStat(b *testing.B) {
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create tmpfs root mount: %v", err)
|
||||
}
|
||||
defer mntns.DecRef(vfsObj)
|
||||
defer mntns.DecRef()
|
||||
|
||||
var filePathBuilder strings.Builder
|
||||
filePathBuilder.WriteByte('/')
|
||||
@@ -374,7 +374,7 @@ func BenchmarkVFS2MemfsMountStat(b *testing.B) {
|
||||
if err != nil {
|
||||
b.Fatalf("failed to create tmpfs root mount: %v", err)
|
||||
}
|
||||
defer mntns.DecRef(vfsObj)
|
||||
defer mntns.DecRef()
|
||||
|
||||
var filePathBuilder strings.Builder
|
||||
filePathBuilder.WriteByte('/')
|
||||
|
||||
@@ -51,7 +51,7 @@ func newTmpfsRoot(ctx context.Context) (*vfs.VirtualFilesystem, vfs.VirtualDentr
|
||||
root := mntns.Root()
|
||||
return vfsObj, root, func() {
|
||||
root.DecRef()
|
||||
mntns.DecRef(vfsObj)
|
||||
mntns.DecRef()
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -423,7 +423,8 @@ func (mntns *MountNamespace) IncRef() {
|
||||
}
|
||||
|
||||
// DecRef decrements mntns' reference count.
|
||||
func (mntns *MountNamespace) DecRef(vfs *VirtualFilesystem) {
|
||||
func (mntns *MountNamespace) DecRef() {
|
||||
vfs := mntns.root.fs.VirtualFilesystem()
|
||||
if refs := atomic.AddInt64(&mntns.refs, -1); refs == 0 {
|
||||
vfs.mountMu.Lock()
|
||||
vfs.mounts.seq.BeginWrite()
|
||||
|
||||
Reference in New Issue
Block a user