concepts

VFS — Virtual File System

The VFS is the kernel abstraction that presents a common filesystem interface to applications regardless of the backing filesystem. Path resolution traverses directory entries and mount points; a dentry connects a name in a parent directory to an inode (or records a negative lookup). Opening creates a file object referenced by a descriptor; its state includes an offset and file status flags. A duplicated descriptor shares this open file description; an independent open normally has a separate offset. Looking up metadata does not require creating an open file description for the target. Individual filesystems implement operations behind this interface. A pathname can be replaced while an already-open descriptor still refers to the original object. To investigate, compare stat on a pathname with fstat on a descriptor; compare device and inode together, not inode alone. Symlink traversal, mount boundaries, permissions and concurrent rename matter. The example uses only a private temporary directory and demonstrates stable descriptor identity after rename; it does not inspect kernel VFS objects directly. Example prerequisites: Linux, Bash and Python 3 standard library; run as a non-root user in a private temporary working directory. Example scope: native userspace observation. Expected output: renamed object still open; replacement is distinct. No system configuration changes.

Formal Syntax & Structure

linux syntaxlinux
Lookup: pathname → mount + dentry → inode; open: descriptor → open file description → path + file operations

Parameters & Attributes

NameTypeDescription
dentrykernel objectName lookup and parent association.
inodekernel objectMetadata and filesystem operation association.
open file descriptionkernel objectOpen instance with offset and flags.

Return Value

Concept / observation

The model describes object relationships, not a callable function. stat/fstat expose selected metadata; example prints a stable identity comparison.

Working Example

Example Snippetlinux
python3 - <<'PY'import os, tempfilefrom pathlib import Pathwith tempfile.TemporaryDirectory() as d:    p = Path(d) / 'original'    p.write_bytes(b'old')    with p.open('rb') as f:        p.rename(Path(d) / 'moved')        p.write_bytes(b'new')        old, new = os.fstat(f.fileno()), p.stat()        assert (old.st_dev, old.st_ino) != (new.st_dev, new.st_ino)        assert f.read() == b'old' and p.read_bytes() == b'new'print('renamed object still open; replacement is distinct')PY
Linux Reference