Skip to content

Commit

Permalink
container: always check if mountpoint is mounted
Browse files Browse the repository at this point in the history
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: #17042

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Oct 9, 2023
1 parent 9beb3a9 commit 8ac2aa7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libpod/container_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 8ac2aa7

Please sign in to comment.