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: Document 'recursive' and 'bind' mount options extensions #530

Closed
wants to merge 1 commit into from

Conversation

wking
Copy link
Contributor

@wking wking commented Aug 13, 2016

The 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.

We may eventually add entries for other mount(8) command-line options (e.g. --move, --make-shared, …), but I've left those off until someone pitches a motivational use case for them.

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 to that example with an unset type and:

"options": ["rbind", ...]

and that would have been closer to mount(8)'s --rbind API, but I've gone with recursive here to stay closer to mount(2). This will scale better if/when we eventually add options for MS_SLAVE, etc.

Since there are existing consumers using the old example format and similar things like:

$ 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.

Spun off from here and here.

@hqhq
Copy link
Contributor

hqhq commented Aug 31, 2016

LGTM

Approved with PullApprove

"source": "/volumes/testing",
"options": ["rbind","rw"]
"options": ["recursive", bind", "rw"]
Copy link
Member

Choose a reason for hiding this comment

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

Quote missing on bind.

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.

We may eventually add entries for other mount(8) command-line options
(e.g. --move, --make-shared, ...), but I've left those off until
someone pitches a motivational use case for them.

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 to that example with an unset type and:

  "options": ["rbind", ...]

and that would have been closer to mount(8)'s --rbind API, but I've
gone with 'recursive' here to stay closer to mount(2).  This will
scale better if/when we eventually add options for MS_SLAVE, etc.

Since there are existing consumers using the old example format and
similar things like:

  $ git log --oneline -1 | cat
  03e8b89 Merge pull request opencontainers#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.

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Aug 31, 2016

I've pushed 1ef593805b3277 which:

  • Fixed a missing quote around ‘bind’ 1.
  • Removed a stale ‘rbind’ reference 2.

@crosbymichael
Copy link
Member

NOT LGTM

recursive is not even an option, @wking just made it up and added it to a doc. MS_REC makes no sense what-so-ever outside of a bind mount and that is why we, mount, and everyone else in the world supports rbind and bind not recursive and recursive,bind.

Checking the mount options for bind or rbind is fine if the type is empty and is a good idea. But this does not require a spec change but can be updated in the runtime code. Its not critical to spec the change because passing bind as the fstype/device in the mount syscall does not cause any issues and is ignored.

This is getting old, maintainers, please watch what you approve.

@wking
Copy link
Contributor Author

wking commented Nov 6, 2016

On Fri, Oct 28, 2016 at 2:06PM -0700, Michael Crosby wrote:

MS_REC makes no sense what-so-ever outside of a bind mount and that
is why we, mount, and everyone else in the world supports rbind and
bind not recursive and recursive,bind.

And mount(8) also has --make-rshared, --make-rslave, --make-rprivate,
and --make-runbindable, all of which use MS_REC [1](and I pointed out
the MS_SLAVE case in my topic post). So I still think a separate
‘recursive’ option is better.

However, if the maintainer consensus is that separate recursive
versions (rbind now and rshared, rslave, … later) are the way to go,
I'll reroll this PR to make that happen. Were there any other
concerns with this PR? Should I open a new one that goes down the r*
path? What I want to avoid is widespread use (including in
runtime-tools, opencontainers/runtime-tools#119) of an undefined
(in the nasal demons sense) mount option.

wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Apr 14, 2017
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.

We may eventually add entries for other mount(8) command-line options
(e.g. --move, --make-shared, ...), but I've left those off until
someone pitches a motivational use case for them.

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 [1].  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:

  $ git log --oneline -1 | cat
  03e8b89 Merge pull request opencontainers#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(8) now will make life less confusing in the future.

[1]: opencontainers#530 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 10, 2017
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 opencontainers#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]: opencontainers#530 (comment)
[4]: opencontainers#771 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 10, 2017
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 opencontainers#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]: opencontainers#530 (comment)
[4]: opencontainers#771 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
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