Commit Graph

37 Commits

Author SHA1 Message Date
Justin Terry (VM)
0110b3c0bc Introduce the Windows lcow diff/snaphotter
Implements the Windows lcow differ/snapshotter responsible for managing
the creation and lifetime of lcow containers on Windows.

Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
2018-08-28 13:51:04 -07:00
Wei Fu
67b54c6670 Support >= 128 layers in overlayfs snapshots
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 <fhfuwei@163.com>
2018-08-07 10:59:36 +08:00
Michael Crosby
0105959c3d Don't prevent boot on temp cleanup
Fixes #2462
Fixes #2455

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-13 16:07:17 -04:00
Vincent Demeester
832b05ae67
Update tests to use gotest.tools angel
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 21:02:01 +02:00
Michael Crosby
009ba4d797 Move testutils to pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-22 17:08:38 -04:00
Derek McGowan
6eee2a0785
Merge pull request #2324 from kolyshkin/mountinfo
mount/mountinfo_linux: parser speed up
2018-05-07 13:46:39 -07:00
Kir Kolyshkin
8eec9259e6 mount/mountinfo_linux: parser speed up
The mountinfo parser implemented via `fmt.Sscanf()` is slower than the one
using `strings.Split()` and `strconv.Atoi()`. This rewrite helps to speed it
up to a factor of 8x, here is a result from `go bench`:

> BenchmarkParsingScanf-4            300          22294112 ns/op
> BenchmarkParsingSplit-4           3000           2780703 ns/op

I tried other approaches, such as using `fmt.Sscanf()` for the first
three (integer) fields and `strings.Split()` for the rest, but it slows
things down considerably:

> BenchmarkParsingMixed-4           1000           8827058 ns/op

Note the old code uses `fmt.Sscanf` first, then a linear search for the
'-' field, then a split for the last 3 fields. The new code relies
on a single split.

One other thing is, the new code is more future proof as it skips
extra optional fields before the separator (currently there are none).

I have also added more comments to aid in future development.

Finally, the test data is fixed to not have white space before
the first field.

Based on a similar change in Moby,
 https://github.com/moby/moby/pull/36091

[v2: remove no-op break statement to silence staticcheck]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-07 11:38:37 -07:00
Tom Godkin
fc8bce59b9 Use user-specific temp directory if set
This allows non-privileged users to use containerd. This is part of a
larger track of work integrating containerd into Cloudfoundry's garden
with support for rootless.

[#156343575]

Signed-off-by: Claudia Beresford <cberesford@pivotal.io>
2018-05-04 10:27:58 +01:00
Christopher Jones
f1639bca4b
testing: cleanup loopback devices on test skip
Fixes a case where loopback devices wouldn't get cleaned up
when a test was being skipped

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
2018-04-18 12:39:21 -04:00
Kunal Kushwaha
3491b9ea4a Copyright header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-03-05 10:07:58 +09:00
Derek McGowan
3b4fcf771a
Merge pull request #2112 from crosbymichael/temp-mounts
Add temp mount location to manage temp mounts
2018-02-21 12:56:23 -08:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Michael Crosby
b2ec177bb2 Call temp mounts and unmount in containerd server
Fixes #2004

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-14 15:16:54 -05:00
Michael Crosby
bc974a7a32 Create temp mount location manager
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-02-14 15:14:02 -05:00
Daniel Nephin
3279acca82 Check timestamps in snapshot storage test suite
also use t.Helper()
convert assertions to canonical

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-02-12 12:26:26 -05:00
Daniel Nephin
ef48a0268e Migrate to gotestyourself/assert
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2018-02-12 12:26:26 -05:00
Lantao Liu
d0779a6145 Simplify mount.Lookup.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-02-01 03:25:05 +00:00
Michael Crosby
d179c61231 Revert "Use jsoniteer for faster json encoding/decoding"
This reverts commit 4233b87b89.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-29 15:47:48 -05:00
Michael Crosby
4233b87b89 Use jsoniteer for faster json encoding/decoding
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-01-26 16:32:55 -05:00
Darren Stahl
dcff993653 Update Windows runtime to use snapshotter and differ layers
This changes the Windows runtime to use the snapshotter and differ
created layers, and updates the ctr commands to use the snapshotter and differ.

Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 14:40:24 -08:00
Darren Stahl
a5a9f91832 Implement Windows snapshotter and differ
This implements the Windows snapshotter and diff Apply function.
This allows for Windows layers to be created, and layers to be pulled
from the hub.

Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-01-23 14:40:23 -08:00
Derek McGowan
dfd7ee122f
Clean up error logs and messages in temp mount
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-01-05 15:37:11 -08:00
yanxuean
cb58bb885a solve incorrect unmount
1. add WithTempMount for better unmount and remove
2. solve incorrect unmount for
   diff.DiffMounts,
   diff.Apply,
   oci.WithUsername,
   oci.WithUserID,
   remapRootFS

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2018-01-06 00:28:16 +08:00
Michael Crosby
b0ca685874 Retry unmount on EBUSY and return errors
This is another WIP to fix #1785.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-12-04 11:31:08 -05:00
Daniel Nephin
f9e969bac8 Use gometalinter for linting
gometalinter runs linters in parallel for faster linting
it provides a uniform way of whitelisting lines using // nolint or the exclude
field in the config

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-03 18:02:27 -04:00
Michael Crosby
1d298c89a4 Fix windows lint issues and enable ci
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-25 16:15:45 -04:00
Michael Crosby
9956fa4b33 Remove solaris files
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-24 15:35:12 -04:00
Yanqiang Miao
d7c4611848 Ensure getting the correct mountinfo corresponds to path
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2017-10-08 17:16:28 +08:00
Michael Crosby
451421b615 Comment more packages to pass go lint
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-02 13:54:56 -04:00
Tobias Klauser
4a582405b9 mount: fix CString memory leaks
Make sure to call C.free on C strings allocated using C.CString.

C.CString allocates memory in the C heap using malloc. It is the callers
responsibility to free them. See
https://golang.org/cmd/cgo/#hdr-Go_references_to_C for details.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-09-15 10:55:53 +02:00
Akihiro Suda
a560e5e0ef mount: fix read-only bind (#1368)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-04 04:44:56 +00:00
Derek McGowan
502734116d
Update loopback to return error
Avoid calling testing function in creation closure since the
context may no longer be valid.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-08-22 16:09:38 -07:00
Edward Pilatowicz
56c1f5c184 Add solaris build support
Signed-off-by: Edward Pilatowicz <edward.pilatowicz@oracle.com>
2017-08-07 12:40:21 -07:00
Ian Campbell
d42cb88ba2 Loop umount'ing rootfs until there are no more mounts
This is simpler than trying to count how many successful mounts we made.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-20 10:50:08 +01:00
Ian Campbell
8b365117a2 containerd-shim: Do not remount root MS_SLAVE
Mounting as MS_SLAVE here breaks use cases which want to use
rootPropagation=shared in order to expose mounts to the host (and other
containers binding the same subtree), mounting as e.g. MS_SHARED is pointless
in this context so just remove.

Having done this we also need to arrange to manually clean up the mounts on
delete, so do so.

Note that runc will also setup root as required by rootPropagation, defaulting
to MS_PRIVATE.

Fixes #1132.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2017-07-20 10:50:08 +01:00
Akihiro Suda
0ab2227377 mount: add mount.Lookup for ease of implementing snapshotters
`func Lookup(dir string) (Info, error)` returns the mount
info that corresponds to the dir

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-06-06 09:27:53 +00:00
Michael Crosby
d7af92e00c Move Mount into mount pkg
This moves both the Mount type and mountinfo into a single mount
package.

This also opens up the root of the repo to hold the containerd client
implementation.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-05-22 16:41:12 -07:00