libcontainer/specconv/spec_linux: Support empty 'type' for bind mounts#1753
Conversation
5e73b68 to
060f9a3
Compare
|
Looks okay, probably needs a test though. And I think |
060f9a3 to
bc225e7
Compare
What sort of test were you looking for? An integration test? Something in |
An integration test would be nice, but if that's too overkill for simply testing bind-mounts, then a |
ad8781b to
0aa6e4e
Compare
From the "Creating a bind mount" section of mount(2) [1]: > If mountflags includes MS_BIND (available since Linux 2.4), then > perform a bind mount... > > The filesystemtype and data arguments are ignored. This commit adds support for configurations that leave the OPTIONAL type [2] unset for bind mounts. There's a related spec-example change in flight with [3], although my personal preference would be a more explicit spec for the whole mount structure [4]. [1]: http://man7.org/linux/man-pages/man2/mount.2.html [2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.1/config.md#L102 [3]: opencontainers/runtime-spec#954 [4]: opencontainers/runtime-spec#771 Signed-off-by: W. Trevor King <wking@tremily.us>
| source := m.Source | ||
| if m.Type == "bind" { | ||
| device := m.Type | ||
| if flags|unix.MS_BIND != 0 { |
There was a problem hiding this comment.
This test is always true.
This should be:
if flags&unix.MS_BIND != 0 {
(& vs |)
This is causing opencontainers/runtime-tools#651
I'll prepare a PR.
/cc @dongsupark
PR opencontainers#1753 introduced a test on the mount flags but the binary operator was wrong, see opencontainers#1753 (comment) This was noticed when investigating opencontainers/runtime-tools#651 Symptoms: in the container, /proc/self/mountinfo displays some mounts as follow: 296 279 0:67 / /tmp rw,nosuid - tmpfs /home/dpark/go/src/github.com/opencontainers/runc/tmpfs rw,size=65536k,mode=755 Signed-off-by: Alban Crequy <alban@kinvolk.io>
PR #1753 introduced a test on the mount flags but the binary operator was wrong, see opencontainers/runc#1753 (comment) This was noticed when investigating opencontainers/runtime-tools#651 Symptoms: in the container, /proc/self/mountinfo displays some mounts as follow: 296 279 0:67 / /tmp rw,nosuid - tmpfs /home/dpark/go/src/github.com/opencontainers/runc/tmpfs rw,size=65536k,mode=755 Signed-off-by: Alban Crequy <alban@kinvolk.io>
PR #1753 introduced a test on the mount flags but the binary operator was wrong, see opencontainers/runc#1753 (comment) This was noticed when investigating opencontainers/runtime-tools#651 Symptoms: in the container, /proc/self/mountinfo displays some mounts as follow: 296 279 0:67 / /tmp rw,nosuid - tmpfs /home/dpark/go/src/github.com/opencontainers/runc/tmpfs rw,size=65536k,mode=755 Signed-off-by: Alban Crequy <alban@kinvolk.io>
From the “Creating a bind mount” section of
mount(2):This pull request adds support for configurations that leave the OPTIONAL
typeunset for bind mounts. There's a related spec-example change in flight with opencontainers/runtime-spec#954, although my personal preference would be a more explicit spec for the whole mount structure (opencontainers/runtime-spec#771).