You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
config: Document 'rbind' and 'bind' mount options extensions
They are not filesystem types, so they don't belong in 'type'. The
specs claim mount(2) as inspiration for this modeling (which makes
sense, since that's the syscall Linux runtimes will make to implement
it), and there (recursive) bind is represented by mountflags (MS_REC |
MS_BIND). Currently the 'options' property handles both mount(2)'s
mountflags and data, so 'options' is a good spot for these two
settings.
Before this commit, we were punting this sort of table to mount(8)'s
filesystem-independent mount options. With this commit we drop the
mount(8) reference and replace it with explicit requirements based on
mount(2), as approved by Michael [1]. Personally, I prefer the old
mount(8) punt, but have been unable to get (recursive) bind documented
without removing it. The option strings still come from mount(8)'s
filesytem-independent mount options with the following exceptions:
* move, rbind, rprivate, rshared, rslave, and runbindable are exposed
in mount(8) through long options (e.g. --move).
* (no)acl is listed under filesystem-specific mount options (e.g. for
ext2).
This commit covers the MS_* entries from [2] with the following
exceptions:
* MS_VERBOSE, which has been deprecated in favor of MS_SILENT.
* MS_KERNMOUNT, since the mount(2) calls won't be kern_mount calls and
they are not covered in mount(8).
* MS_SUBMOUNT and other flags documented as "internal to the kernel".
* MS_RMT_MASK, since it's a mask and not a flag.
* MS_MGC_*, since the magic mount flag is ignored since Linux 2.4
according to mount(2).
The example I'm touching used:
"type": "bind",
...
"options": ["rbind", ...]
but I don't see a point to putting 'bind' in 'type' when it's not a
filesystem type and you already have 'rbind' in 'options'. We could
have stuck closer mount(2) by using:
"options": ["recursive", "bind", ...]
but while that approach extends more conveniently to the other
recursive mounts (recursive shared, slave, private, and unbindable
mounts), there has been resistance to a direct MS_REC analog [3,4]. I
think that resistance is ungrounded (obviously the kernel and mount(2)
feels like a composable MS_REC makes sense), but I'm not a mainainer.
Since there are existing consumers using the old example format and
similar things like runtime-tools:
$ git log --oneline -1 | cat
03e8b89 Merge pull request #176 from hmeng-19/set_oom_score_adj
$ ./ocitools generate --template <(echo '{}') --bind ab:cd:ro | jq '.mounts[0]'
{
"destination": "cd",
"type": "bind",
"source": "ab",
"options": [
"bind",
"ro"
]
}
this may be a breaking change for some spec consumers (although that
ocitools example will still work, because 'options' contains 'bind',
which means the 'type' will be ignored). But even if there are broken
consumers, we're still pre-1.0, the spec never explained what
bind/rbind meant before this commit, and consolidating the Linux mount
spec around mount(2) now will make life less confusing in the future.
[1]: http://ircbot.wl.linuxfoundation.org/meetings/opencontainers/2017/opencontainers.2017-05-09-20.07.log.html#l-24
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fs.h?id=refs/tags/v4.11#n105
[3]: #530 (comment)
[4]: #771 (comment)
Signed-off-by: W. Trevor King <[email protected]>
Copy file name to clipboardExpand all lines: config.md
+64-13Lines changed: 64 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,18 +55,73 @@ For Windows, see [mountvol][mountvol] and [SetVolumeMountPoint][set-volume-mount
55
55
56
56
***`destination`** (string, REQUIRED) Destination of mount point: path inside container.
57
57
This value MUST be an absolute path.
58
+
* Linux: runtimes MUST pass this value to [`mount(2)`][mount.2] as the `target` argument.
58
59
* Windows: one mount destination MUST NOT be nested within another mount (e.g., c:\\foo and c:\\foo\\bar).
59
60
* Solaris: corresponds to "dir" of the fs resource in [zonecfg(1M)][zonecfg.1m].
60
-
***`type`** (string, OPTIONAL) The filesystem type of the filesystem to be mounted.
61
-
* Linux: valid *filesystemtype* supported by the kernel as listed in */proc/filesystems* (e.g., "minix", "ext2", "ext3", "jfs", "xfs", "reiserfs", "msdos", "proc", "nfs", "iso9660").
62
-
* Windows: the type of file system on the volume, e.g. "ntfs".
63
-
* Solaris: corresponds to "type" of the fs resource in [zonecfg(1M)][zonecfg.1m].
61
+
***`type`** (string, OPTIONAL) The type of filesystem to mount.
62
+
If `type` is unset, the runtime MAY ask the kernel to guess the desired type.
63
+
Depending on the mount `options`, the `type` field MAY be ignored.
64
+
* Linux: when `type` is set, runtimes MUST pass the value to [`mount(2)`][mount.2] as the `filesystemtype` argument.
65
+
`type` is ignored when `options` contains `bind` or `rbind`; see the `MS_BIND` description in [mount(2)][mount.2].
66
+
* Windows: the type of file system on the volume, e.g. "ntfs".
67
+
* Solaris: corresponds to "type" of the fs resource in [zonecfg(1M)][zonecfg.1m].
64
68
***`source`** (string, OPTIONAL) A device name, but can also be a directory name or a dummy.
65
-
* Windows: the volume name that is the target of the mount point, \\?\Volume\{GUID}\ (on Windows source is called target).
66
-
* Solaris: corresponds to "special" of the fs resource in [zonecfg(1M)][zonecfg.1m].
69
+
* Linux: when `type` is set, runtimes MUST pass the value to [`mount(2)`][mount.2] as the `source` argument.
70
+
When `type` is not set, the value used for the `source` argument is unspecified.
71
+
* Windows: the volume name that is the target of the mount point, \\?\Volume\{GUID}\ (on Windows source is called target).
72
+
* Solaris: corresponds to "special" of the fs resource in [zonecfg(1M)][zonecfg.1m].
67
73
***`options`** (list of strings, OPTIONAL) Mount options of the filesystem to be used.
68
-
* Linux: supported options are listed in the [mount(8)][mount.8] man page. Note both [filesystem-independent][mount.8-filesystem-independent] and [filesystem-specific][mount.8-filesystem-specific] options are listed.
69
-
* Solaris: corresponds to "options" of the fs resource in [zonecfg(1M)][zonecfg.1m].
74
+
* Linux: runtimes MUST call [`mount(2)`][mount.2] with an initially-zero `mountflags` argument altered by applying the following `options` in the listed order:
Runtimes MUST call [`mount(2)`][mount.2] with the `data` pointing at a string containing, in the listed order, all options not listed in the above table joined with comma delimiters.
122
+
If `options` contains no options from the above table, `data` may be either a pointer to an empty string or `NULL`.
123
+
124
+
* Solaris: corresponds to "options" of the fs resource in [zonecfg(1M)][zonecfg.1m].
70
125
71
126
### Example (Linux)
72
127
@@ -80,9 +135,8 @@ For Windows, see [mountvol][mountvol] and [SetVolumeMountPoint][set-volume-mount
80
135
},
81
136
{
82
137
"destination": "/data",
83
-
"type": "bind",
84
138
"source": "/volumes/testing",
85
-
"options": ["rbind","rw"]
139
+
"options": ["rbind","rw"]
86
140
}
87
141
]
88
142
```
@@ -829,9 +883,6 @@ Here is a full example `config.json` for reference.
Copy file name to clipboardExpand all lines: specs-go/config.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -112,7 +112,7 @@ type Platform struct {
112
112
typeMountstruct {
113
113
// Destination is the path where the mount will be placed relative to the container's root. The path and child directories MUST exist, a runtime MUST NOT create directories automatically to a mount point.
114
114
Destinationstring`json:"destination"`
115
-
// Type specifies the mount kind.
115
+
// Type specifies the type of filesystem to mount.
116
116
Typestring`json:"type,omitempty"`
117
117
// Source specifies the source path of the mount. In the case of bind mounts on
118
118
// Linux based systems this would be the file on the host.
0 commit comments