docs/runtime
Alexander Larsson 2ffef1b7eb devmapper: Avoid AB-BA deadlock
We currently drop the global lock while holding a per-device lock when
waiting for device removal, and then we re-aquire it when the sleep is done.
This is causing a AB-BA deadlock if anyone at the same time tries to do any
operation on that device like this:

thread A:             thread B
grabs global lock
grabs device lock
releases global lock
sleeps
                      grabs global lock
                      blocks on device lock
wakes up
blocks on global lock

To trigger this you can for instance do:

ID=`docker run -d fedora sleep 5`
cd /var/lib/docker/devicemapper/mnt/$ID
docker wait $ID
docker rm $ID &
docker rm $ID

The unmount will fail due to the mount being busy thus causing the
timeout and the second rm will then trigger the deadlock.

We fix this by adding a lock ordering such that the device locks
are always grabbed before the global lock. This is safe since the
device lookups now have a separate lock.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-04-02 09:05:00 +02:00
..
execdriver Ensure a reliable way to kill ghost containers on reboot 2014-04-01 07:11:41 +00:00
graphdriver devmapper: Avoid AB-BA deadlock 2014-04-02 09:05:00 +02:00
networkdriver Merge pull request #4931 from crosbymichael/gen-mac-addr-for-bridge 2014-04-02 02:47:56 +03:00
container.go Merge pull request #4833 from crosbymichael/pluginflag 2014-04-01 13:34:08 -07:00
container_unit_test.go Move runtime and container into sub pkg 2014-03-09 23:03:40 -07:00
runtime.go Send sigterm and wait forever 2014-04-01 07:12:50 +00:00
runtime_aufs.go graphdriver: build tags 2014-03-17 21:54:05 -04:00
runtime_btrfs.go btrfs: build tags 2014-03-18 13:44:23 -04:00
runtime_devicemapper.go graphdriver: build tags 2014-03-17 21:54:05 -04:00
runtime_no_aufs.go graphdriver: build tags 2014-03-17 21:54:05 -04:00
server.go Add IsRunning to server interface 2014-03-09 23:16:15 -07:00
sorter.go Move runtime and container into sub pkg 2014-03-09 23:03:40 -07:00
state.go Fix since time exit display when s.FinishedAt is zero 2014-03-21 15:28:02 +09:00
utils.go Add --opt arguments for drivers 2014-03-27 21:47:47 +01:00
utils_test.go Update imports to be consistent 2014-04-01 07:07:42 +00:00
volumes.go Force abs paths for host volumes 2014-03-31 19:10:19 +00:00