moby--moby/daemon/graphdriver
Sebastiaan van Stijn 25ee00c494
pkg/system: move EnsureRemoveAll() to pkg/containerfs
pkg/system historically has been a bit of a kitchen-sink of things that were
somewhat "system" related, but didn't have a good place for. EnsureRemoveAll()
is one of those utilities. EnsureRemoveAll() is used to both unmount and remove
a path, for which it depends on both github.com/moby/sys/mount, which in turn
depends on github.com/moby/sys/mountinfo.

pkg/system is imported in the CLI, but neither EnsureRemoveAll(), nor any of its
moby/sys dependencies are used on the client side, so let's move this function
somewhere else, to remove those dependencies from the CLI.

I looked for plausible locations that were related; it's used in:

- daemon
- daemon/graphdriver/XXX/
- plugin

I considered moving it into a (e.g.) "utils" package within graphdriver (but not
a huge fan of "utils" packages), and given that it felt (mostly) related to
cleaning up container filesystems, I decided to move it there.

Some things to follow-up on after this:

- Verify if this function is still needed (it feels a bit like a big hammer in
  a "YOLO, let's try some things just in case it fails")
- Perhaps it should be integrated in `containerfs.Remove()` (so that it's used
  automatically)
- Look if there's other implementations (and if they should be consolidated),
  although (e.g.) the one in containerd is a copy of ours:
  https://github.com/containerd/containerd/blob/v1.5.9/pkg/cri/server/helpers_linux.go#L200

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-03 00:22:26 +01:00
..
aufs pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
btrfs pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
copy Use syscall.Timespec.Unix 2022-01-03 16:51:02 +01:00
devmapper refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
fuse-overlayfs pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
graphtest refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
overlay pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
overlay2 pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
overlayutils refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
register Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
vfs pkg/system: move EnsureRemoveAll() to pkg/containerfs 2022-03-03 00:22:26 +01:00
windows refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
zfs Lock down docker root dir perms. 2021-10-05 09:57:00 +02:00
counter.go graphdriver: Fix RefCounter memory leak 2018-02-09 10:26:06 +08:00
driver.go daemon/graphdriver: normalize comment formatting 2019-11-27 15:43:23 +01:00
driver_freebsd.go Add canonical import comment 2018-02-05 16:51:57 -05:00
driver_linux.go storage-driver: promote overlay2, make Btrfs and ZFS opt-in 2021-07-21 14:53:56 +02:00
driver_test.go refactor: move from io/ioutil to io and os package 2021-08-27 14:56:57 +08:00
driver_unsupported.go Update to Go 1.17.0, and gofmt with Go 1.17 2021-08-24 23:33:27 +02:00
driver_windows.go Add canonical import comment 2018-02-05 16:51:57 -05:00
errors.go Add canonical import comment 2018-02-05 16:51:57 -05:00
fsdiff.go Add layer id to NaiveDiffDriver untar timing log 2018-10-05 16:28:40 -07:00
plugin.go goimports: fix imports 2019-09-18 12:56:54 +02:00
proxy.go Move plugin client creation to the extension point 2018-05-25 15:18:53 -04:00