Skip to content

Mount volumes with the runtime's discard and the record's own options - #2175

Closed
MayCXC wants to merge 2 commits into
apple:mainfrom
MayCXC:volume-mount-options
Closed

Mount volumes with the runtime's discard and the record's own options#2175
MayCXC wants to merge 2 commits into
apple:mainfrom
MayCXC:volume-mount-options

Conversation

@MayCXC

@MayCXC MayCXC commented Aug 27, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Closes #2168.

A volume's ext4 sits on a sparse host file the service created, so the blocks a workload frees belong back on the host as it runs. That is the runtime's concern, owned where the mount is assembled beside the caching and sync modes the runtime already sets there: ext4 volumes mount with continuous discard on every attachment, and a read-only mount parses the option as a no-op.

volume create --opt also stored driver options the mount path never read back. The local driver's spelling for a volume's own mount options is the o key, a comma separated list the way docker's local driver takes it, and docker never injects defaults into it: everything in o is what the caller named. o resolves into each attachment's options now, split the way the attachment's own option suffix already is, so what a volume was created with rides along everywhere it attaches, and the user's list stays exactly the user's.

Adjacent: #2021 reports the analogous non-release of freed space for virtio-fs bind mounts, which this does not address; #1940 asks for the supported --volume options to be documented.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

New integration coverage reads /proc/mounts inside the container: an ext4 volume's line holds discard on a plain-created volume, and a volume created with --opt o=noatime mounts with its record's option beside the runtime's discard.

Integration suite: 397 passed. Unit suite: 772 passed. make fmt, make check clean.

MayCXC added 2 commits August 27, 2026 20:16
A volume's ext4 sits on a sparse host file the service created, so the
blocks a workload frees belong back on the host as it runs. That is the
runtime's concern, owned where the mount is assembled beside the
caching and sync modes the runtime already sets there: ext4 volumes
mount with continuous discard on every attachment, and a read only
mount parses the option as a no-op.

volume create --opt also stored driver options the mount path never
read back. The local driver's spelling for a volume's own mount options
is the o key, a comma separated list the way docker's local driver
takes it, and docker never injects defaults into it: everything in o is
what the caller named. Resolve o into each attachment's options, split
the way the attachment's own option suffix already is, so what a volume
was created with rides along everywhere it attaches, and the user's
list stays exactly the user's.
/proc/mounts carries the truth: an ext4 volume's line holds discard on
a plain-created volume, and a volume created with --opt o=noatime
mounts with its record's option beside the runtime's discard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: volume create --opt o= is never applied at mount time, and volumes never discard freed blocks

2 participants