Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@squeed
Copy link
Contributor

@squeed squeed commented Oct 21, 2016

Fixes #3302

@jellonek
Copy link
Contributor

LGTM

Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

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

A couple of change requests. Can you please also add the missing testcase?


// Linux can't bind-mount with readonly in a single operation, so remount +ro
if readOnly {
if err := syscall.Mount("", destination, "bind", syscall.MS_REMOUNT|syscall.MS_RDONLY|syscall.MS_BIND, ""); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

I think you should use flags here, otherwise you may be dropping the MS_REC flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MS_REC is not needed here. For whatever reason, you can't MS_REC a MS_REMOUNT.

// Linux can't bind-mount with readonly in a single operation, so remount +ro
if readOnly {
if err := syscall.Mount("", destination, "bind", syscall.MS_REMOUNT|syscall.MS_RDONLY|syscall.MS_BIND, ""); err != nil {
syscall.Unmount(destination, 0) // If err, try to unmount, fail
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we want to unmount on err. I guess this will just terminate the guest, automatically killing the leftover mounts, right?

@jonboulle
Copy link
Contributor

great catch! Is there an issue somewhere about sharing this logic between the stage1s..?

@squeed
Copy link
Contributor Author

squeed commented Oct 24, 2016

@jonboulle, No, no issue. There is a snarky TODO I added though :-). (I'll create one)

@squeed
Copy link
Contributor Author

squeed commented Oct 24, 2016

filed #3311 for cleanup.

@squeed
Copy link
Contributor Author

squeed commented Oct 25, 2016

@lucab updated the tests too, PTAL. Thanks!

Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

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

LGTM. Even though I'm still not completely sure this is 100% correct, it is at least saner than before.

@lucab lucab added this to the v1.18.0 milestone Oct 25, 2016
@lucab lucab merged commit 68301bd into rkt:master Oct 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants