Skip to content
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

config: Drop 'type' from bind-mount example #954

Closed
wants to merge 1 commit into from

Conversation

wking
Copy link
Contributor

@wking wking commented Mar 6, 2018

This example initially came in with b3918a2, but the bind value is not one of the types you can get out of /proc/filesystems. Instead, bind mounts should leave the type unset and put either bind or rbind in options (although neither of those are documented either, #771). Since documenting (r)bind seems to be too difficult (for reasons I don't understand), we should at least stop setting type in the example to stop confusing users.

Runc still checks .Type instead of .Options for bind-ness in a few places, but we can address all of those by setting .Device to bind depending on .Options here.

This initially came in with b3918a2 (Add bind mount example,
2015-06-30), but the 'bind' value is not one of the types you can get
out of /proc/filesystems.  Instead, bind mounts should leave the type
unset and put either 'bind' or 'rbind' in options (although neither of
those are documented either [1]).  Since documenting (r)bind seems to
be too difficult, we should at least stop setting type in the example
to stop confusing users [2,3].

Runc still checks .Type instead of .Options for bind-ness in a few
places [4,5,6], but we can address all of those by setting .Device to
"bind" depending on .Options at [4].

[1]: opencontainers#771
[2]: opencontainers/runc#1744
[3]: https://groups.google.com/a/opencontainers.org/forum/#!topic/dev/2gia6t1Dnv0
     Subject: Runc default mount type
     Date: Tue, 6 Mar 2018 14:19:40 -0800 (PST)
     Message-Id: <57e18bd7-caad-4e21-bd7e-df016fda3efd@opencontainers.org>
[4]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/specconv/spec_linux.go#L272-L276
[5]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/rootfs_linux.go#L33
[6]: https://github.com/opencontainers/runc/blob/v1.0.0-rc5/libcontainer/rootfs_linux.go#L234

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/runc that referenced this pull request Mar 6, 2018
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>
@wking
Copy link
Contributor Author

wking commented Mar 6, 2018

Runc still checks .Type instead of .Options for bind-ness in a few places, but we can address all of those by setting .Device to bind depending on .Options here.

Filed as opencontainers/runc#1753.

wking added a commit to wking/runc that referenced this pull request Mar 7, 2018
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>
wking added a commit to wking/runc that referenced this pull request Mar 7, 2018
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>
@@ -115,7 +115,6 @@ For POSIX platforms the `mounts` structure has the following fields:
},
{
"destination": "/data",
"type": "bind",
"source": "/volumes/testing",
"options": ["rbind","rw"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it makes sense to have rbind in the options if type:bind is removed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, rbind/bind are options and are not meant to be the "type". The type is not used when performing bind-mounts.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyphar please help me understand this, if I remove rbind from my options it will then not do the binding right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... if I remove rbind from my options it will then not do the binding right?

You need either bind or rbind in options. You do not need to set type for binds per the spec, and if/when opencontainers/runc#1753 lands, you won't need to set type for runc binds either.

wking added a commit to wking/runc that referenced this pull request Mar 7, 2018
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>
wking added a commit to wking/runc that referenced this pull request Mar 7, 2018
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>
wking added a commit to wking/runc that referenced this pull request Mar 7, 2018
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>
@vbatts
Copy link
Member

vbatts commented Apr 4, 2018

i reject this. 'bind' is suitable type.

@vbatts vbatts closed this Apr 4, 2018
@wking
Copy link
Contributor Author

wking commented Apr 4, 2018

i reject this. 'bind' is suitable type.

I'm fine with folks including bind as their type if they want, but I don't see a need to when we also require them to set (r)bind in options. And mount(2) works fine without requiring "bind" for filesystemtype. Can you give more details about why you'd like to keep it? Especially since it diverges from the specified values? If you want to keep it, would you be comfortable documenting it in the spec?

@vbatts
Copy link
Member

vbatts commented Apr 4, 2018 via email

@wking
Copy link
Contributor Author

wking commented Apr 4, 2018 via email

@wking
Copy link
Contributor Author

wking commented Apr 12, 2018

Cross-linking #878 (which I'd forgotten was open). That PR is in flight with docs that would support (but not require) the example change I'd proposed here.

@wking
Copy link
Contributor Author

wking commented Apr 18, 2018

Any chance of revisiting this now that opencontainers/runc#1753 has landed?

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.

4 participants