mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Plumbing context.Context to DecRef() and Release().
context is passed to DecRef() and Release() which is needed for SO_LINGER implementation. PiperOrigin-RevId: 324672584
This commit is contained in:
committed by
gVisor bot
parent
ef11bb936b
commit
b2ae7ea1bb
@@ -92,9 +92,9 @@ 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()
|
||||
func (a *Accessor) Release(ctx context.Context) {
|
||||
a.root.DecRef(ctx)
|
||||
a.mntns.DecRef(ctx)
|
||||
}
|
||||
|
||||
// accessorContext implements context.Context by extending an existing
|
||||
|
||||
@@ -30,7 +30,7 @@ func TestDevtmpfs(t *testing.T) {
|
||||
creds := auth.CredentialsFromContext(ctx)
|
||||
|
||||
vfsObj := &vfs.VirtualFilesystem{}
|
||||
if err := vfsObj.Init(); err != nil {
|
||||
if err := vfsObj.Init(ctx); err != nil {
|
||||
t.Fatalf("VFS init: %v", err)
|
||||
}
|
||||
// Register tmpfs just so that we can have a root filesystem that isn't
|
||||
@@ -48,9 +48,9 @@ func TestDevtmpfs(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create tmpfs root mount: %v", err)
|
||||
}
|
||||
defer mntns.DecRef()
|
||||
defer mntns.DecRef(ctx)
|
||||
root := mntns.Root()
|
||||
defer root.DecRef()
|
||||
defer root.DecRef(ctx)
|
||||
devpop := vfs.PathOperation{
|
||||
Root: root,
|
||||
Start: root,
|
||||
@@ -69,7 +69,7 @@ func TestDevtmpfs(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create devtmpfs.Accessor: %v", err)
|
||||
}
|
||||
defer a.Release()
|
||||
defer a.Release(ctx)
|
||||
|
||||
// Create "userspace-initialized" files using a devtmpfs.Accessor.
|
||||
if err := a.UserspaceInit(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user