-
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
set unix.MS_BIND flag for bind mount #1799
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
always set unix.MS_BIND flag for bind mount, this fixs a error reporting "no such device" with following mount configration, which is similar to mount --bind oldidr newdir { "destination": "/host_dir", "type": "bind", "source": "host_dir" } Without this change, we always have to set the "options": ["rbind"], which will add the flag unix.MS_BIND in parseMountOptions. Alternative fix is to add option "bind" to Mount.Options when it is bind mount so the right flag can be set in parseMountOptions. Signed-off-by: Bin Chen <[email protected]>
On Tue, 8 May 2018 at 7:50 pm, Aleksa Sarai ***@***.***> wrote:
Reject -- type: "bind" is not a valid way of specifying bind-mounts in
the OCI specification. Unfortunately quite a few people have used it
historically, leading to confusion (and the code itself used to depend on
it as well -- which is a mess as well).
I agree with you and using bind as a type in the code did cause a lot
confusion for me.
So what would be spec compatible way to use bind mount? What should be type
in that case? using bind as a type is in many place in lastest code base ,
both code and doc. We have to fix the those first.
Fwiw, the change here imo didn't make thing worse/messier, but again I
agree using bind as type isn't spec compatible.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1799 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAcNfvcGIuSNzv_NdE8x0Kg24rjDW8PBks5twWpvgaJpZM4T2FGz>
.
--
Chen Bin
|
Here is the example used in the runtime-spec.
|
binchenX
pushed a commit
to binchenX/runtime-spec
that referenced
this pull request
May 9, 2018
Per spec, "bind" is not a valid mount type. To use bind mount, the spec compatible way is to set either "bind" or "rbind" in the mount options. Although in practice, setting the type as "bind" won't actually cause an error (at the moment using runc, as well as the system call mount(7) itself) as long as either "bind" or "rbind" is set as well, it provide an incorrect example that "bind" is avalid type, and make people think following config is a valid one for bind mount, which in fact will throw an error in runc. { "destination": "/data", "type": "bind" "source": "/volumes/testing", } [1] tried to automatically add a MS_BIND flag when the type is "bind" but was rejected on the ground it "encourage" the incorrect usage of bind as the mount type, which I agree. Hence, here I change the example in the spec in the hope making it clearer that for bind mount to work, we should use the correct mount options, instead of the "bind" mount type. [1]opencontainers/runc#1799 Signed-off-by: Bin Chen <Bin Chen [email protected]> Signed-off-by: Bin Chen <Bin Chen [email protected]>
binchenX
pushed a commit
to binchenX/runtime-spec
that referenced
this pull request
May 9, 2018
Per spec, "bind" is not a valid mount type. To use bind mount, the spec compatible way is to set either "bind" or "rbind" in the mount options. Although in practice, setting the type as "bind" won't actually cause an error (at the moment using runc, as well as the system call mount(7) itself) as long as either "bind" or "rbind" is set as well, it provide an incorrect example that "bind" is avalid type, and make people think following config is a valid one for bind mount, which in fact will throw an error in runc. { "destination": "/data", "type": "bind" "source": "/volumes/testing", } [1] tried to automatically add a MS_BIND flag when the type is "bind" but was rejected on the ground it "encourage" the incorrect usage of bind as the mount type, which I agree. Hence, here I change the example in the spec in the hope making it clearer that for bind mount to work, we should use the correct mount options, instead of the "bind" mount type. [1]opencontainers/runc#1799 Signed-off-by: Bin Chen <Bin Chen [email protected]>
binchenX
pushed a commit
to binchenX/runtime-spec
that referenced
this pull request
May 9, 2018
Per spec, "bind" is not a valid mount type. To use bind mount, the spec compatible way is to set either "bind" or "rbind" in the mount options. Although in practice, setting the type as "bind" won't actually cause an error (at the moment using runc, as well as the system call mount(7) itself) as long as either "bind" or "rbind" is set as well, it provide an incorrect example that "bind" is avalid type, and make people think following config is a valid one for bind mount, which in fact will throw an error in runc. { "destination": "/data", "type": "bind" "source": "/volumes/testing", } [1] tried to automatically add a MS_BIND flag when the type is "bind" but was rejected on the ground it "encourage" the incorrect usage of bind as the mount type, which I agree. Hence, here I change the example in the spec in the hope making it clearer that for bind mount to work, we should use the correct mount options, instead of the "bind" mount type. [1]opencontainers/runc#1799 Signed-off-by: Bin Chen <[email protected]>
binchenX
added a commit
to binchenX/runtime-spec
that referenced
this pull request
May 9, 2018
Per spec, "bind" is not a valid mount type. To use bind mount, the spec compatible way is to set either "bind" or "rbind" in the mount options. Although in practice, setting the type as "bind" won't actually cause an error (at the moment using runc, as well as the system call mount(7) itself) as long as either "bind" or "rbind" is set as well, it provide an incorrect example that "bind" is avalid type, and make people think following config is a valid one for bind mount, which in fact will throw an error in runc. { "destination": "/data", "type": "bind" "source": "/volumes/testing", } [1] tried to automatically add a MS_BIND flag when the type is "bind" but was rejected on the ground it "encourage" the incorrect usage of bind as the mount type, which I agree. Hence, here I change the example in the spec in the hope making it clearer that for bind mount to work, we should use the correct mount options, instead of the "bind" mount type. [1]opencontainers/runc#1799 Signed-off-by: Bin Chen <[email protected]>
binchenX
added a commit
to binchenX/runtime-spec
that referenced
this pull request
May 9, 2018
Per spec, "bind" is not a valid mount type. To use bind mount, the spec compatible way is to set either "bind" or "rbind" in the mount options. Although in practice, setting the type as "bind" won't actually cause an error (at the moment using runc, as well as the system call mount(7) itself) as long as either "bind" or "rbind" is set as well, it provide an incorrect example that "bind" is avalid type, and make people think following config is a valid one for bind mount, which in fact will throw an error in runc. { "destination": "/data", "type": "bind" "source": "/volumes/testing", } [1] tried to automatically add a MS_BIND flag when the type is "bind" but was rejected on the ground it "encourage" the incorrect usage of bind as the mount type, which I agree. Hence, here I change the example in the spec in the hope making it clearer that for bind mount to work, we should use the correct mount options, instead of the "bind" mount type. [1]opencontainers/runc#1799 Signed-off-by: Bin Chen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
always set unix.MS_BIND flag for bind mount, this fixs a error reporting
"no such device" with following mount configration, which is similar to
mount --bind oldidr newdir
{
"destination": "/host_dir",
"type": "bind",
"source": "host_dir"
}
Without this change, we always have to set the "options":
["rbind"], which will add the flag unix.MS_BIND in parseMountOptions.
Alternative fix is to add option "bind" to Mount.Options when it is bind
mount so the right flag can be set in parseMountOptions.
Signed-off-by: Bin Chen [email protected]