Commit Graph

28 Commits

Author SHA1 Message Date
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
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
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
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
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
010169891e Fix typo in devmapper error message
Upstream-commit: 029625981d3872872f0de95c5a4ea68cb1fa93af
Component: engine
2013-12-25 15:49:58 -05: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
26d7cf1b0c fixed some go vet issues.
Upstream-commit: a6c9a332d040a98c5cf4325491fc8d9aa7e5475b
Component: engine
2013-11-29 22:53:20 -02:00
5f4f9d994f Make devicemapper linux-only
Upstream-commit: 24c03b2d938d383dd7669dc8faad7e2110a11173
Component: engine
2013-11-27 19:12:51 -08:00
097c09d144 Refactor attach loop device in pure Go
Upstream-commit: 74c8f7af756ed03131aee051b0ccb926b77e04db
Component: engine
2013-11-27 15:39:30 -08:00
ae2b7fc016 Reduce debugf frequency to avoid terminal freeze
Upstream-commit: 78d2e2dc373a30eed2bd9f9bb140aa1e153c00f0
Component: engine
2013-11-25 12:06:16 -08:00
fe06edbbd1 Devmapper: wrap calls to os/exec for easier mocking
Upstream-commit: 60f728b170f550262b22b7905dfb280a405df4a7
Component: engine
2013-11-21 02:16:26 +00:00
3bd981cb53 Remove os from devmapper
Upstream-commit: a39bd656622c7dbea534fe34710ed6cb21dd5a90
Component: engine
2013-11-20 13:05:17 -08:00
8380e89daf Remove all syscall calls from devicemapper
Upstream-commit: 5690139785fc2bfaa2f233ed41d5f927a8b28dbf
Component: engine
2013-11-20 12:49:01 -08:00
495a0f953c Mock calls to system functions to facilitate unit testing
Upstream-commit: 92f94f06ae2fb4cddace5b817d6a6e326f3c9b33
Component: engine
2013-11-20 20:05:10 +00:00
90396dc0fc devicemapper tool: Add support for pool resizing
Upstream-commit: a0224e61b48e1dd1378cb955596fba1937e99068
Component: engine
2013-11-19 09:59:13 +01:00
08c42330ce devmapper: Update device-mapper-tool
This makes the device mapper tool work again and adds new features
to get pool status, device status and to list all devices.
Upstream-commit: 80aecc70141f3e7b3138752bf3f0c33b9a273714
Component: engine
2013-11-19 09:44:19 +01:00
052ebaaf52 Move all drivers to the same subdir graphdriver
Upstream-commit: 035c1442424ee502118cdbf2ee2dddafcc0f01cd
Component: engine
2013-11-15 15:48:24 -08:00