diff --git a/pkg/sentry/fsimpl/gofer/save_restore.go b/pkg/sentry/fsimpl/gofer/save_restore.go index 1ae976d4a..132a5f1a3 100644 --- a/pkg/sentry/fsimpl/gofer/save_restore.go +++ b/pkg/sentry/fsimpl/gofer/save_restore.go @@ -29,15 +29,6 @@ import ( "gvisor.dev/gvisor/pkg/sentry/vfs" ) -type saveRestoreContextID int - -const ( - // CtxRestoreServerFDMap is a Context.Value key for a map[string]int - // mapping filesystem unique IDs (cf. InternalFilesystemOptions.UniqueID) - // to host FDs. - CtxRestoreServerFDMap saveRestoreContextID = iota -) - // +stateify savable type savedDentryRW struct { read bool @@ -181,7 +172,7 @@ func (d *dentry) loadParent(parent *dentry) { // CompleteRestore implements // vfs.FilesystemImplSaveRestoreExtension.CompleteRestore. func (fs *filesystem) CompleteRestore(ctx context.Context, opts vfs.CompleteRestoreOptions) error { - fdmapv := ctx.Value(CtxRestoreServerFDMap) + fdmapv := ctx.Value(vfs.CtxRestoreFilesystemFDMap) if fdmapv == nil { return fmt.Errorf("no server FD map available") } diff --git a/pkg/sentry/vfs/context.go b/pkg/sentry/vfs/context.go index 70a78872c..ff1281023 100644 --- a/pkg/sentry/vfs/context.go +++ b/pkg/sentry/vfs/context.go @@ -27,6 +27,11 @@ const ( // CtxRoot is a Context.Value key for a VFS root. CtxRoot + + // CtxRestoreFilesystemFDMap is a Context.Value key for a map[string]int + // mapping filesystem unique IDs (cf. gofer.InternalFilesystemOptions.UniqueID) + // to host FDs. + CtxRestoreFilesystemFDMap ) // MountNamespaceFromContext returns the MountNamespace used by ctx. If ctx is diff --git a/runsc/boot/vfs.go b/runsc/boot/vfs.go index b1e5f5215..39bc3b435 100644 --- a/runsc/boot/vfs.go +++ b/runsc/boot/vfs.go @@ -1087,7 +1087,7 @@ func (c *containerMounter) configureRestore(ctx context.Context) (context.Contex fdmap[submount.mount.Destination] = submount.goferFD.Release() } } - return context.WithValue(ctx, gofer.CtxRestoreServerFDMap, fdmap), nil + return context.WithValue(ctx, vfs.CtxRestoreFilesystemFDMap, fdmap), nil } func createDeviceFiles(ctx context.Context, creds *auth.Credentials, info *containerInfo, vfsObj *vfs.VirtualFilesystem, root vfs.VirtualDentry) error {