Skip to content

Devicemapper: ignore Nodata errors when delete thin device#35333

Closed
liusdu wants to merge 1 commit into
moby:masterfrom
liusdu:fix_del1
Closed

Devicemapper: ignore Nodata errors when delete thin device#35333
liusdu wants to merge 1 commit into
moby:masterfrom
liusdu:fix_del1

Conversation

@liusdu
Copy link
Copy Markdown
Contributor

@liusdu liusdu commented Oct 30, 2017

if thin device is deteled and the metadata exists, you can not
delete related containers. This patch ignore Nodata errors for
thin device deletion

Signed-off-by: Liu Hua [email protected]

- What I did
When we killed docker with 9 when we delete containers. We maybe get the following issue
"Driver devicemapper failed to remove root filesystem 090f22f17fa1ca1ff4fab4e19e16ca1b0bfd88df43db5567298e3cecc846af03: devicemapper: Error running DeleteDevice dm_task_run failed" #34463 ?
- How I did it
In the container-deleteing process, we delete the thin device first and then delete the metadata. So if docker is killing between these two actions. we can reproduce this issue. This patch ignore this type of errors.
- How to verify it
Because the time windows is very small, so we can remove device of a existed container. And remove it,

  • create a container
docker run  -tid  --name=test ubuntu  bash
  • Get device id and stop container
# docker inspect --format="{{.GraphDriver.Data.DeviceId}}" test
10
 # docker stop test
test
  • delete device and container
# docker stop test
test
# dmsetup message  /dev/mapper/docker-8:2-400468-pool 0 "delete 10"
# docker rm -f test
Error response from daemon: Driver devicemapper failed to remove root filesystem 2ba68a882c7c744fcf046aa46cd0190b2c362e07296341071a914234a66fa53c: devicemapper: Error running deviceCreate (ActivateDevice) dm_task_run failed

- Description for the changelog

@thaJeztah
Copy link
Copy Markdown
Member

ping @kolyshkin PTAL

Comment thread pkg/devicemapper/devmapper.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/do not exist/does not exist/

Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin Nov 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be worth mentioning that the error is being ignored, like

+			logrus.Debugf("devicemapper: Device(id: %d) from pool(%s) does not exist, ignoring", deviceID, poolName)

if thin device is deteled and the metadata exists, you can not
delete related containers. This patch ignore Nodata errors for
thin device deletion

Signed-off-by: Liu Hua <[email protected]>
@liusdu
Copy link
Copy Markdown
Contributor Author

liusdu commented Oct 31, 2017

@thaJeztah updated

@kolyshkin
Copy link
Copy Markdown
Contributor

Looks a bit kludgy, but I can't think of anything better, therefore LGTM

@thaJeztah
Copy link
Copy Markdown
Member

ping @rhvgoyal as well 😄

@vieux
Copy link
Copy Markdown
Contributor

vieux commented Nov 14, 2017

LGTM ping @rhvgoyal

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

actually discussing this, and possibly we can have a test for this; /cc @kolyshkin

@kolyshkin
Copy link
Copy Markdown
Contributor

@liusdu can you create a simple unit test for this, based on your description on how to verify it?

@thaJeztah
Copy link
Copy Markdown
Member

ping @liusdu could you add a test?

@yongtang
Copy link
Copy Markdown
Member

yongtang commented Jan 3, 2018

Added a test case and carries the PR to #35919. Please take a look.

@kolyshkin
Copy link
Copy Markdown
Contributor

I think we can close this one in favor of #35919

@yongtang
Copy link
Copy Markdown
Member

Let me close this one. @liusdu Your commit has been carried in PR #35919. Thanks!

@yongtang yongtang closed this Jan 11, 2018
thaJeztah added a commit that referenced this pull request Jan 20, 2018
Carry #35333: Devicemapper: ignore Nodata errors when delete thin device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants