Fix use of mounted() in overlay.
Handle error and mounted case separately. Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
parent
82b9e60369
commit
57ca2a2101
1 changed files with 10 additions and 0 deletions
|
@ -365,6 +365,16 @@ func (d *Driver) Get(id string, mountLabel string) (string, error) {
|
|||
mergedDir := path.Join(dir, "merged")
|
||||
|
||||
opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", lowerDir, upperDir, workDir)
|
||||
|
||||
// if it's mounted already, just return
|
||||
mounted, err := d.mounted(mergedDir)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if mounted {
|
||||
return mergedDir, nil
|
||||
}
|
||||
|
||||
if err := syscall.Mount("overlay", mergedDir, "overlay", 0, label.FormatMountLabel(opts, mountLabel)); err != nil {
|
||||
return "", fmt.Errorf("error creating overlay mount to %s: %v", mergedDir, err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue