Skip to content

Commit 804a8cd

Browse files
authored
Merge pull request #4568 from erofs/mount_manager
Add support for mount manager
2 parents f1e3904 + 2ba655a commit 804a8cd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

pkg/cmd/container/run_mount.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,20 @@ func generateMountOpts(ctx context.Context, client *containerd.Client, ensuredIm
173173
return nil, nil, nil, err
174174
}
175175

176+
mm := client.MountManager()
177+
178+
active, err := mm.Activate(ctx, tempDir, mounts)
179+
if err == nil {
180+
defer mm.Deactivate(ctx, tempDir)
181+
mounts = active.System
182+
} else if !errors.Is(err, errdefs.ErrNotImplemented) {
183+
return nil, nil, nil, fmt.Errorf("failed to activate mounts: %w", err)
184+
}
185+
176186
// windows has additional steps for mounting see
177187
// https://github.com/containerd/containerd/commit/791e175c79930a34cfbb2048fbcaa8493fd2c86b
178-
unmounter := func(mountPath string) {
179-
if uerr := mount.Unmount(mountPath, 0); uerr != nil {
188+
unmounter := func(tempDir string) {
189+
if uerr := mount.UnmountMounts(mounts, tempDir, 0); uerr != nil {
180190
log.G(ctx).Debugf("Failed to unmount snapshot %q", tempDir)
181191
if err == nil {
182192
err = uerr

0 commit comments

Comments
 (0)