Skip to content

Commit

Permalink
Merge pull request #497 from giuseppe/store-lock-mount
Browse files Browse the repository at this point in the history
store: keep graph lock during Mount
  • Loading branch information
rhatdan authored Dec 23, 2019
2 parents e18327c + a6fec75 commit ac3048f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions store.go
Original file line number Diff line number Diff line change
Expand Up @@ -2479,13 +2479,29 @@ func (s *store) Mount(id, mountLabel string) (string, error) {
if err != nil {
return "", err
}

s.graphLock.Lock()
defer s.graphLock.Unlock()

rlstore.Lock()
defer rlstore.Unlock()
if modified, err := rlstore.Modified(); modified || err != nil {
if err = rlstore.Load(); 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) {
s.graphDriver = nil
s.layerStore = nil
s.graphDriver, err = s.getGraphDriver()
if err != nil {
return "", err
}
s.lastLoaded = time.Now()
}

if rlstore.Exists(id) {
options := drivers.MountOpts{
MountLabel: mountLabel,
Expand Down

0 comments on commit ac3048f

Please sign in to comment.