store: fix graphLock reload

use s.graphLock.Modified() instead of s.graphLock.TouchedSince().

TouchedSince() seems to fail in some cases when comparing the inode
mtime with the current time.

Avoid such kind of problems in a critical code path as store.mount(),
as we must be sure there is already a driver home mount present,
otherwise it the next process may cover the container mount with the
home mount.

Closes: https://github.com/containers/podman/issues/10454

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-05-27 14:56:33 +02:00
parent abb54202ce
commit 09295b3c6b
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED
1 changed files with 6 additions and 1 deletions

View File

@ -2652,8 +2652,13 @@ func (s *store) mount(id string, options drivers.MountOpts) (string, error) {
return "", err
}
modified, err := s.graphLock.Modified()
if err != nil {
return "", err
}
/* We need to make sure the home mount is present when the Mount is done. */
if s.graphLock.TouchedSince(s.lastLoaded) {
if modified {
s.graphDriver = nil
s.layerStore = nil
s.graphDriver, err = s.getGraphDriver()