Commit Graph

123 Commits

Author SHA1 Message Date
d1752e453e Merge pull request #4504 from alexlarsson/devicemapper-waits
devmapper: Increase sleep times and unlock while sleeping
Upstream-commit: b55a79aa1cfedd981653f0e46bb0a8a73ccc6796
Component: engine
2014-03-11 13:17:53 -07:00
7dd068d585 Merge pull request #4499 from alexlarsson/fix-remove-fail
DeviceMapper: Succeed immediately when removing non-existant devices
Upstream-commit: af3ff044a2daaf00f50e17a244a5172b69a86a8e
Component: engine
2014-03-11 10:09:58 -07:00
926a18e3d9 Fix typo in devmapper driver_test
Docker-DCO-1.1-Signed-off-by: Paul Morie <pmorie@gmail.com> (github: pmorie)
Upstream-commit: b3e7df48dfbf3d2300877d1e524132624e9493c3
Component: engine
2014-03-07 12:20:25 -05:00
1368e7356f devmapper: Increase sleep times and unlock while sleeping
We've seen some cases in the wild where waiting for unmount/deactivate
of devmapper devices taking a long time (several seconds). So, we increase
the sleeps to 10 seconds before we timeout. For instance:

https://github.com/dotcloud/docker/issues/4389

But, in order to not keep other processes blocked we unlock the global
dm lock while waiting to allow other devices to continue working.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 81f148be566ab2b17810ad4be61a5d8beac8330f
Component: engine
2014-03-06 18:36:08 +01:00
2135cdee62 devmapper: Add per-device lock
We currently use a global lock to protect global data (like the
Devices map) as well as device data itself and access to
(non-threadsafe) libdevmapper.

This commit also adds a per-device lock, which will allow per-device
operations to temporarily release the global lock while e.g. waiting.
The per-device lock will make sure that nothing else accesses that
device while we're operating on it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 3e8a02a9399618917194b37435f5eed9ff86fe2f
Component: engine
2014-03-06 18:36:03 +01:00
f8c71718b6 DeviceMapper: Succeed immediately when removing non-existant devices
We've seen situations where removal of "ID-init" failed during
container deletion (EBUSY), after removal of "ID" has succeeded. This
caused the container delete operation to fail, and on the next delete
attempt the removal of "ID" failed immediately with "does not exist".

Ideally we should not fail the ID-init removal, but its also non-ideal
to allow a state where the container is half-removed and we cannot
make progress deleting the container. So, we silently ignore not-exist
errors on device removal.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 1cdd775f5d95c4da2895da85b00ffa2917bbf9b0
Component: engine
2014-03-06 15:12:09 +01:00
d1123e2435 aufs: Skip tests if aufs not supported
This makes it possible to pass the rest of the testsuite without aufs in the kernel.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 9e28c3e3f86664ef8f219f11ef19c74a414346a9
Component: engine
2014-03-03 15:11:49 +01:00
e12f62e6df Properly close archives
All archive that are created from somewhere generally have to be closed, because
at some point there is a file or a pipe or something that backs them. So, we
make archive.Archive a ReadCloser. However, code consuming archives does not
typically close them so we add an archive.ArchiveReader and use that when we're
only reading.

We then change all the Tar/Archive places to create ReadClosers, and to properly
close them everywhere.

As an added bonus we can use ReadCloserWrapper rather than EofReader in several places,
which is good as EofReader doesn't always work right. For instance, many compression
schemes like gzip knows it is EOF before having read the EOF from the stream, so the
EofCloser never sees an EOF.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: f198ee525ad6862dce3940e08c72e0a092380a7b
Component: engine
2014-02-14 13:46:17 +01:00
c0c4c69b1a Merge pull request #4062 from alexlarsson/clean-shutdown
devmapper: Fix shutdown warnings
Upstream-commit: 9997d0c9ed031465b7bc6e4df6f62bcac3758305
Component: engine
2014-02-13 10:45:03 -08:00
3c5478c15e Merge pull request #4056 from alexlarsson/fix-devmapper-test
devicemapper: Fix tests on fedora
Upstream-commit: 47df7a360ad10660639af4bef32afaa29b16ee1c
Component: engine
2014-02-13 15:06:50 +02:00
87fd3e0884 Merge pull request #4055 from alexlarsson/remove-devmapper-dirs
devmapper: Remove directory when removing devicemapper device
Upstream-commit: a66124ec6aab77ed984896773c9d37b7b343c47f
Component: engine
2014-02-11 17:05:56 -05:00
78f5f41e8e devmapper: Remove byHash hack
We no longer pass "pool" anywhere that uses byHash() per the last
commit, so we can now remove this hack.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 6128dcea4a9bbe808baba4e18c9c4fee3a265532
Component: engine
2014-02-11 13:02:00 +01:00
d3d8c35b41 devmapper: Fix shutdown warnings
Shutdown contains debug warnings like:

[debug] deviceset.go:699 [deviceset docker-0:33-17945897] waitRemove(/dev/mapper/docker-0:33-17945897-pool)
[debug] deviceset.go:380 libdevmapper(3): libdm-common.c:552 (-1) Device /dev/mapper/docker-0:33-17945897-pool not found

This is because shutdown is using removeDeviceAndWait() to remove the pool device and the
wait part fails because the pool is gone.

We fix this by adding a pool specific removal function which avoids all the trickiness of the
normal remove.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: eab270395e5b47b16a41c54ec6e1427f8144bffc
Component: engine
2014-02-11 12:47:59 +01:00
9ca9fdc33f devicemapper: Fix tests on fedora
If /dev/loop-control exists on the system running the test then
ioctlLoopCtlGetFree() will be called, but if not it won't.  It does
not exist in the standard docker build environment, so the tests
currently require this to not be called. This makes it instead
optional, allowing the tests to run on e.g. Fedora.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: eb4578daee98561b16d11d2978b5f5e297d903e8
Component: engine
2014-02-11 09:42:34 +01:00
abb4de8546 devmapper: Remove directory when removing devicemapper device
We're currently leaving around lots of empty directories in
/var/lib/docker/devicemapper/mnt/ for removed images and containers.
Fix this by removing the directory when the device is removed.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 2343fe44533f19ebae5e6127f4a2a19d1d8773fa
Component: engine
2014-02-11 09:40:13 +01:00
81f4bd236b devmapper: Enable skip_block_zeroing
This makes the device mapper not zero out blocks allocated on the
thinp device. This is safe in our use case, as we access the device
via a filesystem that doesn't leak any uninitialized data to userspace.

This partially helps with https://github.com/dotcloud/docker/issues/3280
and should generally improve preformance on the devicemapper backend.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 695719b29a6311a56faae0c6ed3c985b7a75add0
Component: engine
2014-02-09 07:29:28 +01:00
3959ecf0a9 devmapper: Fix MountDevice for non-existing Device
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 693d3f8c6ab4c9fed5fe4c5ac5fcb44568fe1638
Component: engine
2014-02-06 23:08:17 +01:00
4c4ba56ea4 devmapper: Fix UnmountDevice for non-existing device
Properly error out if passed an id that doesn't exist.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 304e33a2fe2d006cc1063c8060c6e22c9ade3d59
Component: engine
2014-02-06 22:26:09 +01:00
8a70fd74d7 devmapper: Handle EBUSY while removing
For some reason we seem to get transient EBUSY when removing
thinp devices, which prohibit removing containers. When
this happens we retry a few times which seems to fix the
issue for me.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 2c82fd93d8a01cc1f53fe861378e6d2dca0486c6
Component: engine
2014-02-06 13:14:49 +01:00
931e825d56 devmapper: Use removeDeviceAndWait in DeviceSet.removeDevice()
This makes sure the device is removed just like in deactivateDevice.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 7e25cd5891f84c2fab656c364002290e4b87f934
Component: engine
2014-02-06 13:14:49 +01:00
d2595404a2 devmapper: Move refcounting to DeviceSet
We already have some kind of refcounting in DeviceSet, this fleshes
it out to allow it to completely subsume the refcounting in
devmapper.Driver.

This allows us to drop the double refcounting, and the locking inside
devmapper.Driver. This, in particular the locking simplification will
make it easier in the future to parallelize the device mapper.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: b95c560fdda4813319a2377e240592a3261e30ef
Component: engine
2014-02-06 13:14:42 +01:00
9d46aecf3b devmapper: add and use removeDeviceAndWait helper
This adds a function that calls the lowlevel removeDevice
and then waits for it to finish.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: dca21dfac77de2bbd69dd5a52b8a2b7816a54367
Component: engine
2014-02-05 21:27:12 +01:00
3ce6127194 devmapper: Rename DeviceSet.RemoveDevice to DeleteDevice
"Remove" is a bit overloaded, as it is also what deactivating a
device mapper device is called. Using "delete" is more clear here.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 63d4b293e7c91b8e2ed8da56f338f1bd0a4e1464
Component: engine
2014-02-05 21:27:12 +01:00
23812229e0 Merge pull request #3893 from tianon/clean-up-btrfs-error-messages
Fix several btrfs driver error messages
Upstream-commit: 9431b8d503e1fc02e22431fded0c15e4a7dc4b0c
Component: engine
2014-02-03 09:51:41 -08:00
e9fcfe019f Fix several btrfs driver error messages
Several of the error messages were wrong, but not one of them was helpful, so this fixes them to include the important information (the actual error), and a correct description of which operation failed.

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: f7f8e3c2b3818d351781f96ef68432eba0fc2fda
Component: engine
2014-02-03 09:12:18 -07:00
6732035ba0 Remove reference to <linux/btrfs.h>, and instead use <btrfs/ioctl.h> like we're supposed to (from btrfs-progs)
This fixes compilation issues when btrfs.h isn't available (because we just need the relevant structs, which for userspace programs are supposed to come from btrfs-progs instead of the kernel headers).

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 6922f1be08111d889b0585b763b08f92d7a55e05
Component: engine
2014-02-01 23:23:33 -07:00
e8f6d5eb59 Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
Upstream-commit: 065dd231dd7d7858df982a8decfade9df936cf63
Component: engine
2014-01-31 03:16:42 -07:00
185286d85e Remove all darwin specific files and use more generic _unsupported with build tags.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: 45dd051e8ee2e0e18d8ffec99f65878c20bd11e9
Component: engine
2014-01-30 23:10:56 +00:00
c5b80fe410 Merge pull request #3718 from alexlarsson/btrfs
Add btrfs support to docker
Upstream-commit: 637a1dcab65c7335d979d42af190a53d9bbea9f7
Component: engine
2014-01-30 10:00:44 -08:00
658be79c83 btrfs: Add comment to Put()
Document why we don't need to do anything in Put().

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: a1851a6d3e69d67bfc4e6bfdec85ba58293351b9
Component: engine
2014-01-28 09:56:51 +01:00
98d13d7d17 Fix for #3674 Can't rm containers when disk full
Rather than creating a new directory and moving it there before
deleting that new directory, just move the directory we intend to
delete.

In the old way, the Mkdirall could fail, which meant that you
couldn't delete containers when the disk was full.

Tested.

Docker-DCO-1.1-Signed-off-by: Peter Waller <p@pwaller.net> (github: pwaller)
Upstream-commit: 6f3d8d39085e7dc31f757c0221eca7ab5f220224
Component: engine
2014-01-27 21:34:11 +00:00
a906461155 Add experimenta btrfs driver
This is an experimental btrfs driver. To use it you must have
/var/lib/docker mounted on a btrfs filesystem and explicitly
specify DOCKER_DRIVER=btrfs in the docker daemon environment.

It works by using subvolumes for the docker image/container layers.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: e51af36a85126aca6bf6da5291eaf960fd82aa56
Component: engine
2014-01-22 21:44:09 +01:00
47913f96e1 Merge pull request #3073 from alexlarsson/refcount-driver-mounts
Refcount driver mounts
Upstream-commit: f61a91f50a753e0b8878675b4bab8ee4dc2a70e1
Component: engine
2014-01-22 11:42:17 -08:00
bb99a3bd7b aufs: Unmount inactive devices
This implements the new Put() operation such that
Get()/Put() maintains a refcount for each ID, mounting
only on first Get() and unmounting on the last Get().

This means we avoid littering the system with lots of mounts
and free resources related to them.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 5fe26ee426b9d748605c538829f30885462ad932
Component: engine
2014-01-21 11:26:11 +01:00
4d1276ba85 devicemapper: Unmount inactive devices
This implements the new Put() operation such that
Get()/Put() maintains a refcount for each ID, mounting
only on first Get() and unmounting on the last Get().

This means we avoid littering the system with lots of mounts
and active devicemapper devices and free resources related
to them.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)

asdfljk
Upstream-commit: 886f650d9b2133fb61e7cc5b0bb7795246852026
Component: engine
2014-01-21 11:26:11 +01:00
5e35604785 Add Put() to graphdriver API and use it
This makes all users of Put() have a corresponding call
to Get() which means we will be able to track whether
any particular ID is in use and if not unmount it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: bcaf6c2359d83acd5da54f499e21f4a148f491c5
Component: engine
2014-01-21 11:25:37 +01:00
e8d9d10625 archive: Remove unused features
This simplifies that code that calls out to tar by removing support
for now unused features.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 4fb1db7f742fb34a7a06621d0698063de87a572c
Component: engine
2014-01-20 20:26:20 +01:00
20e6d0be01 Extract mount into pkg.
Mount is self contained and generic, it should be in pkg, to allow other pkg modules to use it.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
Upstream-commit: 2e094db6390dde57263c07665290b1477bb6df7e
Component: engine
2014-01-20 13:59:29 -05:00
c4546db20c Discard all data on devicemapper devices when deleting them
This works around the fact that deleting a device in a thin pool
doesn't discard the free space. Unfortunately even this is not perfect,
as it seems discards are respected only for blocks that has never been
shared in the thin device code. However, this has been fixed in the
upstream kernel device-mapper tree:

http://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=0ab1c92ff748b745c1ed7cde31bb37ad2c5f901a

When this hits the kernel I belive this will fully return space
for removed images/containers to the host FS. For now it only
helps partially (which is better than nothing).

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
Upstream-commit: 93e120e7d67313086d8bdecbcb57ea68958f91e4
Component: engine
2014-01-13 13:41:04 +01:00
0cf00ffca6 Make vfs error more explicit
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
Upstream-commit: ef7e000a13eed5ebf761ab4ca83fa8f727170aa5
Component: engine
2014-01-07 16:02:41 -08:00
010169891e Fix typo in devmapper error message
Upstream-commit: 029625981d3872872f0de95c5a4ea68cb1fa93af
Component: engine
2013-12-25 15:49:58 -05:00
dd4dc32856 Improve interface by moving to subpkg
Enable builds on OSX
Upstream-commit: 7bc96aec7bf978e87cb87935bd55f85e2cb1664a
Component: engine
2013-12-18 16:42:49 -08:00
eb112b17e6 Fix unmount issues
Upstream-commit: a6fdc5d208b6726a33d30bd25ab115131a298b90
Component: engine
2013-12-18 15:24:08 -08:00
8eec37c741 Handle external mounts outside of lxc
Upstream-commit: 45d7dcfea276841cce782feced3a2eb3eab01208
Component: engine
2013-12-18 13:46:02 -08:00
9b574d4dfb Fix OSX compilation for aufs
Upstream-commit: e481c82fa9521ecc719b29b314543a205c0b53ec
Component: engine
2013-12-18 10:18:49 -08:00
db82e5f1c7 Merge pull request #2897 from crosbymichael/aufs-42
Increase max image depth to 127
Upstream-commit: f5ab2516d8d50c2ef756fe92d7218bc3248d714a
Component: engine
2013-12-13 16:03:57 -08:00
07db46c5e4 devmapper: add missing defines
Add some missing defines which are needed for compiling on older systems
like RHEL 6.
Upstream-commit: a015f38f4a886518828fe3807ee7dc9ff8ab9585
Component: engine
2013-12-06 10:13:47 -06:00
3f773fbd23 Merge pull request #2966 from andrewsmedina/govet2
fixed some `go vet` issues.
Upstream-commit: 5f55c1aee1a6acdce35f5d7be776104d66e44483
Component: engine
2013-12-04 17:57:10 -08:00
ce0389c1a1 fixed Looback typo.
Upstream-commit: fea432bdf542a469ae9b5b114b6858a7bc56b323
Component: engine
2013-11-30 16:28:52 -02:00
6a2bf8a9db using errors.New instead fmt.Error.
Upstream-commit: e8437e8fcffae3661b9decdc1c576083c0de5219
Component: engine
2013-11-30 01:02:09 -02:00