moby--moby/daemon/graphdriver/zfs
Kir Kolyshkin a450a575a6 zfs: fix ebusy on umount
This commit is a set of fixes and improvement for zfs graph driver,
in particular:

1. Remove mount point after umount in `Get()` error path, as well
   as in `Put()` (with `MNT_DETACH` flag). This should solve "failed
   to remove root filesystem for <ID> .... dataset is busy" error
   reported in Moby issue 35642.

To reproduce the issue:

   - start dockerd with zfs
   - docker run -d --name c1 --rm busybox top
   - docker run -d --name c2 --rm busybox top
   - docker stop c1
   - docker rm c1

Output when the bug is present:
```
Error response from daemon: driver "zfs" failed to remove root
filesystem for XXX : exit status 1: "/sbin/zfs zfs destroy -r
scratch/docker/YYY" => cannot destroy 'scratch/docker/YYY':
dataset is busy
```

Output when the bug is fixed:
```
Error: No such container: c1
```
(as the container has been successfully autoremoved on stop)

2. Fix/improve error handling in `Get()` -- do not try to umount
   if `refcount` > 0

3. Simplifies unmount in `Get()`. Specifically, remove call to
   `graphdriver.Mounted()` (which checks if fs is mounted using
   `statfs()` and check for fs type) and `mount.Unmount()` (which
   parses `/proc/self/mountinfo`). Calling `unix.Unmount()` is
   simple and sufficient.

4. Add unmounting of driver's home to `Cleanup()`.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2017-12-01 13:46:47 -08:00
..
MAINTAINERS
zfs.go zfs: fix ebusy on umount 2017-12-01 13:46:47 -08:00
zfs_freebsd.go Update logrus to v1.0.1 2017-07-31 13:16:46 -07:00
zfs_linux.go Update logrus to v1.0.1 2017-07-31 13:16:46 -07:00
zfs_test.go Add quota support to VFS graphdriver 2017-11-06 15:53:51 -08:00
zfs_unsupported.go Remove solaris build tag and `contrib/mkimage/solaris 2017-11-02 00:01:46 +00:00