Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

mounts: Fix bug while checking if /dev was bind-mounted #539

Merged
merged 1 commit into from
Jan 5, 2018

Conversation

amshinde
Copy link
Collaborator

@amshinde amshinde commented Jan 4, 2018

There was a bug in the way we were checking if /dev was
bindmounted from the host.

Signed-off-by: Archana Shinde [email protected]

@amshinde
Copy link
Collaborator Author

amshinde commented Jan 4, 2018

cc @egernst

Copy link
Collaborator

@egernst egernst left a comment

Choose a reason for hiding this comment

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

LGTM

container.go Outdated
c.systemMountsInfo.BindMountDev = true
} else {
c.systemMountsInfo.BindMountDev = false
if m.Destination == "/dev" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice catch - in the original case, it would only return true of the last of the mounts happened to be the bind mount from host /dev?

Any rationale for dividing it into two if clauses?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@amshinde the logic of the patch works, but I have the same question than @egernst, why don't we keep only one if statement ?

if m.Source == "/dev" && m.Destination == "/dev" && m.Type == "bind" {

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also @amshinde, can we create a test to assert the expected behaviour (here, in runtime or tests)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@sboeuf I just add the split to make it clear we need to care of the destination first, thats all. But yeah we could very well have it as one statement.

@amshinde amshinde force-pushed the fix-bug-bindmount-dev branch from de86549 to bca9e98 Compare January 4, 2018 18:57
@sboeuf
Copy link
Collaborator

sboeuf commented Jan 4, 2018

LGTM

Approved with PullApprove Approved with PullApprove

container.go Outdated
for _, m := range c.mounts {
if m.Source == "/dev" && m.Destination == "/dev" && m.Type == "bind" {
if m.Destination == "/dev" && m.Source == "/dev" && m.Type == "bind" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Huh? Isn't this change is a nop (and confusing)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@amshinde Could you please revert that change so that we can merge that PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@jodh-intel @sameo Seems like I missed repushing a change I made yesterday:(
Changes are in.

There was a bug in the way we were checking if /dev was
bindmounted from the host.

Signed-off-by: Archana Shinde <[email protected]>
@amshinde amshinde force-pushed the fix-bug-bindmount-dev branch from bca9e98 to 4c2c9a4 Compare January 5, 2018 19:24
@jodh-intel
Copy link
Collaborator

jodh-intel commented Jan 5, 2018

lgtm

Approved with PullApprove Approved with PullApprove

@sameo
Copy link
Collaborator

sameo commented Jan 5, 2018

LGTM

Approved with PullApprove Approved with PullApprove

@jodh-intel
Copy link
Collaborator

Coveralls is "stuck" again (clearcontainers/jenkins#9), but has actually run if you look at the 16.04 CI build log: https://coveralls.io/jobs/32568132.

It claims coverage fell by 3.5% but clearly it's lying, so merging.

@jodh-intel jodh-intel merged commit d281220 into containers:master Jan 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants