Skip to content

devicemapper issue: Race condition between device deferred removal and resume device. #23418

Closed

Description

@shishir-a412ed

Output of docker version:

Client:
 Version:      1.12.0-dev
 API version:  1.24
 Go version:   go1.5.4
 Git commit:   6ac8599
 Built:        Thu Jun  9 13:52:39 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.0-dev
 API version:  1.24
 Go version:   go1.5.4
 Git commit:   6ac8599
 Built:        Thu Jun  9 13:52:39 2016
 OS/Arch:      linux/amd64

Output of docker info:

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 3
Server Version: 1.12.0-dev
Storage Driver: devicemapper
 Pool Name: docker-8:19-16121923-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 1.074 GB
 Backing Filesystem: xfs
 Data file: /dev/loop1
 Metadata file: /dev/loop2
 Data Space Used: 709 MB
 Data Space Total: 107.4 GB
 Data Space Available: 106.7 GB
 Metadata Space Used: 913.4 kB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.147 GB
 Thin Pool Minimum Free Space: 10.74 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: true
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.109 (2015-09-22)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 4.4.9-300.fc23.x86_64
Operating System: Fedora 23 (Workstation Edition)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 11.72 GiB
Name: dhcp-10-19-62-127.boston.devel.redhat.com
ID: M4W2:KN7L:WVHC:KGXZ:ZNAN:CJJJ:5PWS:V7VV:GPHO:65Y3:4UEP:MCUX
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: shm32
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

Additional environment details (AWS, VirtualBox, physical, etc.):
OpenShift Enterprise (OSE)

Steps to reproduce the issue:
Let's consider an example scenario that involves deferred removal

  1. A new base image gets created (e.g. 'docker load -i'). The base device is activated and mounted at some point in time during image creation.
  2. While image creation is in progress, a privileged container is started
    from another image and the host's mount name space is shared with this
    container ('docker run --privileged -v /:/host').
  3. Image creation completes and the base device gets unmounted. However,
    as the privileged container still holds a reference on the base image
    mount point, the base device cannot be removed right away. So it gets
    flagged for deferred removal.
  4. Next, the privileged container terminates and thus its reference to the
    base image mount point gets released. The base device (which is flagged
    for deferred removal) may now be cleaned up by the device-mapper. This
    opens up an opportunity for a race between a 'kworker' thread (executing
    the do_deferred_remove() function) and the Docker daemon (executing the
    CreateSnapDevice() function).

Describe the results you received:
http://pastebin.com/mAp32Zgk

Describe the results you expected:
I should be able to successfully create and run a docker container.

Additional information you deem important (e.g. issue happens only occasionally):
RHEL 7.2
Openshift Environment
Kernel: 3.10.0-327.10.1.el7.x86_64
lvm2: 2.02.130-5.el7_2.1.x86_64
docker: 1.8.2-10.el7.x86_64
devicemapper*: 1.02.107-5.el7_2.1.x86_64

Activity

  1. shishir-a412ed commented on Jun 9, 2016

    @shishir-a412ed
    ContributorAuthor

    @thaJeztah I am working on a PR for the fix. Will open the PR in sometime.

  2. changed the title [-]Race condition between device deferred removal and resume device.[/-] [+]devicemapper issue: Race condition between device deferred removal and resume device.[/+] on Jun 9, 2016
  3. thaJeztah commented on Jun 9, 2016

    @thaJeztah
    Member
  4. added
    kind/bug
    on Jun 9, 2016
  5. added this to the 1.13.0 milestone on Jan 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/storage/devicemapperkind/bugversion/master

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions