Protect aufs mounts with locks
Parallel aufs mount calls produce invalid argument error.
Fixes #21545
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 824c24e680
)
This commit is contained in:
parent
c4fa814ecd
commit
8facb73a8f
1 changed files with 7 additions and 0 deletions
|
@ -67,6 +67,7 @@ func init() {
|
|||
|
||||
// Driver contains information about the filesystem mounted.
|
||||
type Driver struct {
|
||||
sync.Mutex
|
||||
root string
|
||||
uidMaps []idtools.IDMap
|
||||
gidMaps []idtools.IDMap
|
||||
|
@ -418,6 +419,9 @@ func (a *Driver) getParentLayerPaths(id string) ([]string, error) {
|
|||
}
|
||||
|
||||
func (a *Driver) mount(id string, target string, mountLabel string, layers []string) error {
|
||||
a.Lock()
|
||||
defer a.Unlock()
|
||||
|
||||
// If the id is mounted or we get an error return
|
||||
if mounted, err := a.mounted(target); err != nil || mounted {
|
||||
return err
|
||||
|
@ -432,6 +436,9 @@ func (a *Driver) mount(id string, target string, mountLabel string, layers []str
|
|||
}
|
||||
|
||||
func (a *Driver) unmount(mountPath string) error {
|
||||
a.Lock()
|
||||
defer a.Unlock()
|
||||
|
||||
if mounted, err := a.mounted(mountPath); err != nil || !mounted {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue