-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Replace mount fork hack with CLONE_FS #7513
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
Conversation
fuweid
left a comment
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.
LGTM on green!
Thanks!
|
Would it be possible to have some unit tests? |
0c09578 to
a915e89
Compare
Test added. |
a915e89 to
01b10e6
Compare
|
Interesting error I've not seen before: https://github.com/containerd/containerd/actions/runs/3237587338/jobs/5304881990#step:9:56393 |
| // If the thread is unlocked go will try to use it for other goroutines. | ||
| // However it is not possible to restore the thread state after CLONE_FS. | ||
| // | ||
| // Once the goroutine exits the thread should eventually be terminated by go. |
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.
If the calling goroutine exits without unlocking the thread, the thread will be terminated.
So it will be fine.
|
This comment was marked as duplicate.
This comment was marked as duplicate.
bee7db3 to
4a0fb1c
Compare
|
Wow. We have found a Go bug :) |
|
Should be fixed now with 1.19.3. |
|
Windows failure looks unrelated. |
|
Should we get a separate PR for the usual "upgrade the world" to 1.19.3 versus just the one GH Actions CI setting? Should be able to get that in quickly and then rebase this |
This change spins up a new goroutine, locks it to a thread, then unshares CLONE_FS which allows us to `Chdir` from inside the thread without affecting the rest of the program. The thread is no longer usable after unshare so it leaves the thread locked to prevent go from returning the thread to the thread pool. Signed-off-by: Brian Goff <[email protected]>
4a0fb1c to
a24ef09
Compare
This change spins up a new goroutine, locks it to a thread, then unshares CLONE_FS which allows us to
Chdirfrom inside the thread without affecting the rest of the program.The thread is no longer usable after unshare so it leaves the thread locked to prevent go from returning the thread to the thread pool. (see https://pkg.go.dev/runtime#UnlockOSThread)
Thanks @corhere for working on a bunch of this stuff in moby and pointing out that we should be able to do this instead.