diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-02-05 06:04:30 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-02-16 14:18:53 -0500 |
commit | 5d1ec2960df41b15040534e6507932cc5cf83542 (patch) | |
tree | 71b529a7872a33e111339f2d37ab8a2bfbe1410f /libpod/runtime_cstorage.go | |
parent | 7fb347a3d40afeb4c565c2066fbade7f003e3e50 (diff) | |
download | podman-5d1ec2960df41b15040534e6507932cc5cf83542.tar.gz podman-5d1ec2960df41b15040534e6507932cc5cf83542.tar.bz2 podman-5d1ec2960df41b15040534e6507932cc5cf83542.zip |
Do not reset storage when running inside of a container
Currently if the host shares container storage with a container
running podman, the podman inside of the container resets the
storage on the host. This can cause issues on the host, as
well as causes the podman command running the container, to
fail to unmount /dev/shm.
podman run -ti --rm --privileged -v /var/lib/containers:/var/lib/containers quay.io/podman/stable podman run alpine echo hello
* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy
* unlinkat /var/lib/containers/storage/overlay-containers/a7f3c9deb0656f8de1d107e7ddff2d3c3c279c11c1635f233a0bffb16051fb2c/userdata/shm: device or resource busy
Since podman is volume mounting in the graphroot, it will add a flag to
/run/.containerenv to tell podman inside of container whether to reset storage or not.
Since the inner podman is running inside of the container, no reason to assume this is a fresh reboot, so if "container" environment variable is set then skip
reset of storage.
Also added tests to make sure /run/.containerenv is runnig correctly.
Fixes: https://github.com/containers/podman/issues/9191
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'libpod/runtime_cstorage.go')
0 files changed, 0 insertions, 0 deletions