Skip to content

Commit 85309b0

Browse files
author
Kazuyoshi Kato
committed
cmd/ctr: protect contents from GC
"ctr image import" didn't have a lease. Due to that, GC would remove contents during the import process. Fixes #5690. Signed-off-by: Kazuyoshi Kato <[email protected]>
1 parent 7eceeb9 commit 85309b0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cmd/ctr/commands/images/import.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ If foobar.tar contains an OCI ref named "latest" and anonymous ref "sha256:deadb
122122
return err
123123
}
124124
}
125+
126+
ctx, done, err := client.WithLease(ctx)
127+
if err != nil {
128+
return err
129+
}
130+
defer done(ctx)
131+
125132
imgs, err := client.Import(ctx, r, opts...)
126133
closeErr := r.Close()
127134
if err != nil {

0 commit comments

Comments
 (0)