-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libcontainer/specconv/spec_linux: Support empty 'type' for bind mounts #1753
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 <[email protected]>
@@ -269,13 +269,17 @@ func CreateLibcontainerConfig(opts *CreateOpts) (*configs.Config, error) { | |||
func createLibcontainerMount(cwd string, m specs.Mount) *configs.Mount { | |||
flags, pgflags, data, ext := parseMountOptions(m.Options) | |||
source := m.Source | |||
if m.Type == "bind" { | |||
device := m.Type | |||
if flags|unix.MS_BIND != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
From the “Creating a bind mount” section of
mount(2)
:This pull request adds support for configurations that leave the OPTIONAL
type
unset 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).