Files
containerd/plugins/mount
Derek McGowan 697a7571a4 erofs: give a dm-verity device a name unique to its mount
The mount handler built the device name from the source path, taking the
base of the parent directory as a snapshot id. That reads an identity
out of a layout only a snapshot directory has. A layer served from a
layer content cache is mounted from the cache, whose parent directory is
a shard named for the first two characters of the digest. Every blob in
a shard then names one device.

A second layer in a shard fails to mount. dmverity.Open finds the name
taken, VerifyDevice compares the existing device's root hash against the
one being mounted, and the mismatch is an error. No layer is served
against the wrong root hash, and none of the colliding layers can be
mounted.

Name the device for the source and the mount point together. Mount
closes the device it creates when the mount fails, so the name has to be
unique to the mount. Neither half is unique alone: a cache serves one
blob to every snapshot of that layer, and a mount point is reused once
the mount before it is gone. A device left behind by a crash is reused
only for the same blob in the same place, where its root hash still
matches. Unmount reads the name back from the mounted source and needs
nothing from either.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-09-11 18:03:15 -07:00
..
2026-07-04 12:08:50 -04:00