gvisorgvisor.dev/gvisor/pkg/sentry/fsimpl/overlay Index | Files

package overlay

import "gvisor.dev/gvisor/pkg/sentry/fsimpl/overlay"

Package overlay provides an overlay filesystem implementation, which synthesizes a filesystem by composing one or more immutable filesystems ("lower layers") with an optional mutable filesystem ("upper layer").

Lock order:

directoryFD.mu / regularFileFD.mu
	filesystem.renameMu
		dentry.dirMu
	    dentry.copyMu
	      filesystem.devMu
	      *** "memmap.Mappable/MappingIdentity locks" below this point
	      dentry.mapsMu
	        *** "memmap.Mappable locks taken by Translate" below this point
	        dentry.dataMu
	      filesystem.ancestryMu

Locking dentry.dirMu in multiple dentries requires that parent dentries are locked before child dentries, and that filesystem.renameMu is locked to stabilize this relationship.

Index

Constants

const Name = "overlay"

Name is the default filesystem name.

Functions

func CreateWhiteout

func CreateWhiteout(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, pop *vfs.PathOperation) error

CreateWhiteout creates a whiteout at pop. Whiteouts are created with character devices with device ID = 0.

Preconditions: pop's parent directory has been copied up.

Types

type FilesystemOptions

type FilesystemOptions struct {

	// If UpperRoot.Ok(), it is the root of the writable upper layer of the
	// overlay.
	UpperRoot vfs.VirtualDentry

	// LowerRoots contains the roots of the immutable lower layers of the
	// overlay. LowerRoots is immutable.
	LowerRoots []vfs.VirtualDentry
}

FilesystemOptions may be passed as vfs.GetFilesystemOptions.InternalData to FilesystemType.GetFilesystem.

+stateify savable

type FilesystemType

type FilesystemType struct{}

FilesystemType implements vfs.FilesystemType.

+stateify savable

func (FilesystemType) GetFilesystem

func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.VirtualFilesystem, creds *auth.Credentials, source string, opts vfs.GetFilesystemOptions) (*vfs.Filesystem, *vfs.Dentry, error)

GetFilesystem implements vfs.FilesystemType.GetFilesystem.

func (FilesystemType) Name

func (FilesystemType) Name() string

Name implements vfs.FilesystemType.Name.

func (FilesystemType) Release

func (FilesystemType) Release(ctx context.Context)

Release implements FilesystemType.Release.

Source Files

copy_up.go directory.go filesystem.go overlay.go regular_file.go save_restore.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
20 packages
Last checked
4 hours ago

Tools for package owners.