container: always check if mountpoint is mounted
when running as a service, the c.state.Mounted flag could get out of sync if the container is cleaned up through the cleanup process. To avoid this, always check if the mountpoint is really present before skipping the mount. [NO NEW TESTS NEEDED] Closes: https://github.com/containers/podman/issues/17042 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
9beb3a9720
commit
8ac2aa7938
|
|
@ -1539,7 +1539,13 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
|
|||
var err error
|
||||
// Container already mounted, nothing to do
|
||||
if c.state.Mounted {
|
||||
return c.state.Mountpoint, nil
|
||||
mounted := true
|
||||
if c.ensureState(define.ContainerStateExited) {
|
||||
mounted, _ = mount.Mounted(c.state.Mountpoint)
|
||||
}
|
||||
if mounted {
|
||||
return c.state.Mountpoint, nil
|
||||
}
|
||||
}
|
||||
|
||||
if !c.config.NoShm {
|
||||
|
|
|
|||
Loading…
Reference in New Issue