-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Support the native snapshotter on FreeBSD #4858
Support the native snapshotter on FreeBSD #4858
Conversation
| // cmd.CombinedOutput() may intermittently return ECHILD because of our signal handling in shim. | ||
| // See #4387 and wait(2). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior around ECHILD and retries is copied from mount_linux.go. There isn't (yet) a shim on FreeBSD, so I don't know if the logic is really necessary, but I left it in to start. If there's a preference to remove it, I'm happy to do so.
| case unix.EBUSY: | ||
| time.Sleep(50 * time.Millisecond) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, the behavior around EBUSY and retries is copied from mount_linux.go. Again, I don't know if the logic is really necessary, but I left it in to start. If there's a preference to remove it, I'm happy to do so.
8e9280b
to
2fb04a0
Compare
| // See #4387 and wait(2). | ||
| const retriesOnECHILD = 10 | ||
| for i := 0; i < retriesOnECHILD; i++ { | ||
| cmd := exec.Command("mount", args...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason not to use mount(2) syscall directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the comment on line 37:
// The "syscall" and "golang.org/x/sys/unix" packages do not define a Mount
// function for FreeBSD, so instead we execute mount(8) and trust it to do
// the right thing
We could use syscall.RawSyscall but using mount(8) felt more reliable to me.
|
|
||
| var ( | ||
| // ErrNotImplementOnUnix is returned for methods that are not implemented | ||
| ErrNotImplementOnUnix = errors.New("not implemented under unix") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- You haven't used this constant on the PR.
- Would it be
ErrNotImplementedorErrNotImplementedOnPlatform? This might be useful for other non-Unix platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This constant is pre-existing (was in mount/mount_unix.go) and used elsewhere in the codebase when compiled for FreeBSD (specifically in pkg/os/mount_unix.go). I left the name as-is to avoid touching other places in the codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. LGTM then.
2fb04a0
to
b667c15
Compare
Rebased on top of the current |
|
Build succeeded.
|
Signed-off-by: Samuel Karp <me@samuelkarp.com>
Signed-off-by: Samuel Karp <me@samuelkarp.com>
b667c15
to
b624486
Compare
|
Build succeeded.
|
|
I believe the devicemapper failures are unrelated to my change as the only change on Linux is a reordering of mount options for the native snapshotter. |
This PR adds support for the native snapshotter on FreeBSD using FreeBSD nullfs.
The native snapshotter passes its test suite and is able to unpack an image for the
freebsd/amd64platform: