Skip to content
This repository has been archived by the owner on Nov 9, 2020. It is now read-only.

Docker compatibility (post 1.12) - Do not increment reference count for a volume if the mount fails. #608

Closed
govint opened this issue Oct 4, 2016 · 8 comments

Comments

@govint
Copy link
Contributor

govint commented Oct 4, 2016

Fix for docker issue moby/moby#22564 has resulted in moby/moby#27116 to send an unmount to the plugin only if the mount actually succeeded. The plugin.go:Mount() function needs to handle the change by incrementing the refcount on a volume only if the mount succeeded. This change will be needed post 1.12 when the Docker fix becomes available.

@govint govint added this to the v1 GA milestone Oct 4, 2016
@govint govint self-assigned this Oct 4, 2016
@govint
Copy link
Contributor Author

govint commented Oct 18, 2016

The fix will be submitted once we have the next version >1.12 of docker where this fix should be available.

@govint
Copy link
Contributor Author

govint commented Oct 18, 2016

Docker PR 27116 is still open and this change can be made once thats in.

@govint govint removed the kind/bug label Oct 21, 2016
@govint govint changed the title Do not increment reference count for a volume if the mount fails. Docker compatibility (post 1.12) - Do not increment reference count for a volume if the mount fails. Oct 21, 2016
@kerneltime
Copy link
Contributor

link moby/moby#27116

@govint
Copy link
Contributor Author

govint commented Nov 11, 2016

Docker issue has been closed and should be available in the upcoming release. Will post PR then.

@govint
Copy link
Contributor Author

govint commented Nov 23, 2016

Docker 1.1.13 is out and am checking with that if the fix is in it and will post the changes.

@govint
Copy link
Contributor Author

govint commented Nov 23, 2016

Docker version
Client:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:44:32 2016
OS/Arch: linux/amd64

Server:
Version: 1.12.3
API version: 1.24
Go version: go1.6.3
Git commit: 6b644ec
Built: Wed Oct 26 21:44:32 2016
OS/Arch: linux/amd64


Command : Uses -w option, docker doesn't issue an unmount on mount failure

docker run --rm -it -w /data -v mount-err:/data busybox

2016-11-22 21:56:34.903730934 -0800 PST [INFO] Attaching volume and creating filesystem name=mount-err fstype=ext4
2016-11-22 21:56:37.803787313 -0800 PST [INFO] Volume and filesystem created name=mount-err fstype=ext4
2016-11-22 21:57:28.917945144 -0800 PST [INFO] Mounting volume name=mount-err
2016-11-22 21:57:29.459062291 -0800 PST [ERROR] Failed to mount name=mount-err error="Mount error"
2016-11-22 21:57:45.748352137 -0800 PST [INFO] Mounting volume name=mount-err
2016-11-22 21:57:45.748403472 -0800 PST [INFO] Already mounted, skipping mount. name=mount-err refcount=2
2016-11-22 21:57:45.749588432 -0800 PST [INFO] Unmounting Volume name=mount-err
2016-11-22 21:57:45.749629524 -0800 PST [INFO] Still in use, skipping unmount request. name=mount-err refcount=1
2016-11-22 21:57:45.808757086 -0800 PST [INFO] Mounting volume name=mount-err
2016-11-22 21:57:45.808916305 -0800 PST [INFO] Already mounted, skipping mount. refcount=2 name=mount-err
2016-11-22 21:57:45.950720607 -0800 PST [INFO] Unmounting Volume name=mount-err
2016-11-22 21:57:45.950950121 -0800 PST [INFO] Still in use, skipping unmount request. name=mount-err refcount=1


Command : Omitted -w option, docker issues an unmount when mount fails

$ docker volume create -d vmdk --name mount-err1
mount-err1

$ docker run --rm -it -v mount-err1:/data busybox
docker: Error response from daemon: Post http://%2Frun%2Fdocker%2Fplugins%2Fvmdk.sock/VolumeDriver.Mount: http: ContentLength=94 with Body length 0.

2016-11-22 23:26:29.284317429 -0800 PST [INFO] Going into ServeUnix - Listening on Unix socket address="/run/docker/plugins/vmdk.sock"
2016-11-22 23:29:35.044887251 -0800 PST [INFO] Attaching volume and creating filesystem name=mount-err1 fstype=ext4
2016-11-22 23:29:38.347367187 -0800 PST [INFO] Volume and filesystem created name=mount-err1 fstype=ext4
2016-11-22 23:30:27.718855021 -0800 PST [INFO] Mounting volume name=mount-err1
2016-11-22 23:30:28.337823239 -0800 PST [ERROR] Failed to mount error="Mount error" name=mount-err1
2016-11-22 23:30:43.442627059 -0800 PST [INFO] Unmounting Volume name=mount-err1
2016-11-22 23:30:43.442734164 -0800 PST [ERROR] Refcount error - still trying to unmount...refcount=0 name=mount-err1
2016-11-22 23:30:43.44301128 -0800 PST [ERROR] Failed to unmount volume. Now trying to detach... mountpoint="/mnt/vmdk/mount-err1" error="invalid argument"
2016-11-22 23:30:43.81071445 -0800 PST [ERROR] Failed to unmount name=mount-err1 error="*** Detach failed: disk=/vmfs/volumes/bigone/dockvols/mount-err1.vmdk not found. VM=564d392b-3cb8-5a4a-862a-3df7a590d97e"


Client:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 18:19:35 2016
OS/Arch: linux/amd64

Server:
Version: 1.12.2
API version: 1.24
Go version: go1.6.3
Git commit: bb80604
Built: Tue Oct 11 18:19:35 2016
OS/Arch: linux/amd64

In Docker version 1.12.2 the behavior is different, docker tries to detach even if unmount fails.


Command: -w option is omitted and unmount is issued.

$ docker run --rm -it -v test-um1:/data busybox
docker: Error response from daemon: VolumeDriver.Mount: Mount error.

2016-11-22 23:34:08.106557938 -0800 PST [INFO] Mounting volume name=test-um1
2016-11-22 23:34:08.49876698 -0800 PST [ERROR] Failed to mount name=test-um1 error="Mount error"
2016-11-22 23:34:08.541197941 -0800 PST [INFO] Unmounting Volume name=test-um1
2016-11-22 23:34:08.541279614 -0800 PST [ERROR] Failed to unmount volume. Now trying to detach... mountpoint="/mnt/vmdk/test-um1" error="invalid argument"
2016-11-22 23:34:08.667107141 -0800 PST [INFO] Mounting volume name=ca-vol-1
2016-11-22 23:34:08.916940671 -0800 PST [ERROR] Failed to unmount name=test-um1 error="*** Detach failed: disk=/vmfs/volumes/bigone/dockvols/test-um1.vmdk not found. VM=4225d240-b7f5-3825-e1c4-e69a08844980"

@govint
Copy link
Contributor Author

govint commented Nov 23, 2016

Tried with 1.13.0-rc-1 and there is no unmount if mount fails (with or without -w option).


$ docker run --rm -it -v test-um3:/data busybox
docker: Error response from daemon: error while mounting volume '/mnt/vmdk/test-um3': Post http://%2Frun%2Fdocker%2Fplugins%2Fvmdk.sock/VolumeDriver.Mount: http: ContentLength=92 with Body length 0.

$ docker run --rm -it -v test-um3:/data busybox
docker: Error response from daemon: error while mounting volume '/mnt/vmdk/test-um3': Post http://%2Frun%2Fdocker%2Fplugins%2Fvmdk.sock/VolumeDriver.Mount: http: ContentLength=92 with Body length 0.
ERRO[0015] error getting events from daemon: net/http: request canceled

2016-11-23 05:29:31.622969018 -0800 PST [INFO] Attaching volume and creating filesystem fstype=ext4 name=test-um3
2016-11-23 05:29:34.454800037 -0800 PST [INFO] Volume and filesystem created name=test-um3 fstype=ext4
2016-11-23 05:30:01.443055606 -0800 PST [INFO] Mounting volume name=test-um3
2016-11-23 05:30:03.116808723 -0800 PST [INFO] Attach complete name=test-um3 event="/dev/disk/by-path/pci-0000:13:00.0-scsi-0:0:1:0": 0x100 == IN_CREATE
2016-11-23 05:30:13.843352572 -0800 PST [INFO] Unmounting Volume name=test-um3
2016-11-23 05:31:04.305515719 -0800 PST [INFO] Mounting volume name=test-um3
2016-11-23 05:31:04.812476102 -0800 PST [ERROR] Failed to mount name=test-um3 error="Mount error"
2016-11-23 05:35:49.375592697 -0800 PST [INFO] Mounting volume name=test-um3
2016-11-23 05:35:49.682465668 -0800 PST [ERROR] Failed to mount name=test-um3 error="Mount error"


As seen there is no refcounting issue (this has the fix for the issue)

@govint
Copy link
Contributor Author

govint commented Feb 14, 2017

Fixed by #906

@govint govint closed this as completed Feb 14, 2017
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

3 participants