Ensure whiteout is not pointing to the current directory
or parent directory before removing. Protects against invalid
removal of the parent or current directory.
Add whiteout related tar tests using manufactured tar conditions.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Chown would normally be a no-op if uid/gid match, however some
filesystems (e.g. NFS) will return EPERM.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Because tasks may be deleted while listing containers, we need to ignore
errors from state requests that are due to a closed error. All of these
get mapped to ErrNotFound, which can be used to filter the entries.
There may be a better fix that does a better job of keeping track of the
intended state of a backend task. The current condition of assuming that
a closed client is a shutdown task may be too naive.
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This allows other packages and plugins to easily exec things without
racing with the reaper.
The reaper is mostly needed in the shim but can be removed in containerd
in favor of the `exec.Cmd` apis
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This linter checks for unnecessary type convertions.
Some convertions are whitelisted because their type is different
on 32bit platforms
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
When a writer is requested for an object that already
exists, add that object to the provided any lease to prevent
other operations from affecting the current lease's use of
that content.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
The DCO check is primarily only relevant as part of CI, so it
doesn't need to be in the Makefile. A contributor looking to
validate their commits can run script/validate/dco.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
The boltdb image store now manages its own transactions when
one is not provided, but allows the caller to pass in a
transaction through the context. This makes the image store
more similar to the content and snapshot stores. Additionally,
use the reference to the metadata database to mark the content
store as dirty after an image has been deleted. The deletion
of an image means a reference to a piece of content is gone
and therefore garbage collection should be run to check if
any resources can be cleaned up as a result.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Directly get and check whether a bucket is empty.
This prevents unnecessarily loading all records of
the buckets into memory just to check existence.
Also added checks for content and snapshots.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This enables the grpc timing histograms via a config option as they are
metrics of high cardinality.
This is useful for perf testing and debugging but should not be the
default on production systems unless needed.
```toml
[metrics]
grpc_histogram = true
```
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Helps with #1935
This hold the shim lock during the state call to make sure that the task
does not get deleted during a state call.
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>