support more overlayfs layers#2502
Conversation
6b8f114 to
47d8a50
Compare
Codecov Report
@@ Coverage Diff @@
## master #2502 +/- ##
==========================================
- Coverage 45.05% 44.95% -0.11%
==========================================
Files 94 95 +1
Lines 9796 9928 +132
==========================================
+ Hits 4414 4463 +49
- Misses 4662 4743 +81
- Partials 720 722 +2
Continue to review full report at Codecov.
|
AkihiroSuda
left a comment
There was a problem hiding this comment.
Can we avoid circular dependency on docker/docker?
|
I see.... the |
There was a problem hiding this comment.
Using this as a dependency is a big no no. Either reimplement or find another solution.
DRY is a liability here.
There was a problem hiding this comment.
Yes @stevvooe. I will find other way to handle this. 😄
There was a problem hiding this comment.
Was looking around for a suggestion, but I think @dmcgowan covered the options in #2497 (comment).
There was a problem hiding this comment.
Found a way to create a Fmountat which we could use here dmcgowan@d8f6d09
There was a problem hiding this comment.
Make a copy of m before altering
There was a problem hiding this comment.
should be ${root}/io.containerd.v1.overlayfs/snapshots
fd89efb to
b41352b
Compare
There was a problem hiding this comment.
Is this officially supported across different versions of Go?
There was a problem hiding this comment.
# https://github.com/golang/go/blob/release-branch.go1.8/src/syscall/exec_linux.go#L46
func runtime_BeforeFork()
func runtime_AfterFork()
# https://github.com/golang/go/blob/release-branch.go1.9/src/syscall/exec_linux.go#L52
func runtime_BeforeFork()
func runtime_AfterFork()
func runtime_AfterForkInChild()
1.9 or higher supports the three features. But, I think go1.10 can work well than go1.9 since the runtime.LockOSThread has been improved.
more input from https://golang.org/doc/go1.10#runtime
There was a problem hiding this comment.
There should still be a page size check in here, we need to offload that to a linux only section though
There was a problem hiding this comment.
This copy should be done as part of the next function, and only when necessary
There was a problem hiding this comment.
Is there no other way to do this without a raw syscall? That should only be necessary in the child process
There was a problem hiding this comment.
I think you are still missing a waitpid or else we will have zombie babies
There was a problem hiding this comment.
I actually don't think you need pipes where, just waitpid(wait4) the exit status and use that. You can always wait on a process, running or not, that you forked off.
There was a problem hiding this comment.
I make it complicated and it can cause the zombie process. I have updated the code. Please take a look.
1ca0406 to
7a57b5c
Compare
There was a problem hiding this comment.
i would almost recommend using unix.Wait4 here to follow the rest of the theme of low level syscalls in this function
There was a problem hiding this comment.
make senses. I will update it.
There was a problem hiding this comment.
should we add loop to retry if the Wait4 return EINTR? it is possible?
7a57b5c to
b9d7839
Compare
There was a problem hiding this comment.
We should still set some buffer room here, maybe start size at 512
There was a problem hiding this comment.
the buffer will be used in pagesize check. have updated it.
b9d7839 to
3a3c261
Compare
|
mount code LGTM |
|
ping @dmcgowan @stevvooe @AkihiroSuda please take a look~ thanks |
There was a problem hiding this comment.
Looks like there should be another check here that after compacting the options do fit a page, i.e. something like
if optionsSize(options) >= pagesize-512 {
return errors.Errorf("can't mount: lower layers list too long")
}There was a problem hiding this comment.
Yet better, move this check to after parseMountOptions() as it's simpler and more precise in there:
flags, data := parseMountOptions(options)
if len(data) >= pagesize {
return errors.Errorf("can't mount: mount options string too long")
}
```
or smth like thatThere was a problem hiding this comment.
make senses. will update it.
There was a problem hiding this comment.
@kolyshkin I add another check after compact and show the error if the mount option is too long.
if we got empty chdir or the data is too long, return the mount options is too long. It is readable to user instead of failed to mount: no such file or directory.
Auto-detect longest common dir in lowerdir option and compact it if the option size is hitting one page size. If does, Use chdir + CLONE to do mount thing to avoid hitting one page argument buffer in linux kernel mount. Signed-off-by: Wei Fu <[email protected]>
3a3c261 to
67b54c6
Compare
|
LGTM |
1 similar comment
|
LGTM |
Auto-detect longest common dir in lowerdir option and compact it if the
option size is hitting one page size. If does, Use chdir + CLONE to do
mount thing to avoid hitting one page argument buffer in linux kernel
mount.
More information is here #2497