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:
Nayana Bidari
2020-08-03 13:36:05 -07:00
committed by gVisor bot
parent ef11bb936b
commit b2ae7ea1bb
252 changed files with 1711 additions and 1668 deletions
+3 -3
View File
@@ -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
+4 -4
View File
@@ -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 {