mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
volume/local.New() always unmount existing mounts
Unmounting does not depend on wether or not loading options failed. This code-path seemed to be used as a "hack" to prevent hitting the unmount on Windows (which does not support unmounting). Moving it outside of the "if" to make more clear that it's independent of loading the options. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
c0f0cf6c19
commit
7e907e29a3
1 changed files with 5 additions and 3 deletions
|
@ -78,6 +78,11 @@ func New(scope string, rootIdentity idtools.Identity) (*Root, error) {
|
|||
path: filepath.Join(r.path, name, volumeDataPathName),
|
||||
quotaCtl: r.quotaCtl,
|
||||
}
|
||||
|
||||
// unmount anything that may still be mounted (for example, from an
|
||||
// unclean shutdown). This is a no-op on windows
|
||||
unmount(v.path)
|
||||
|
||||
if b, err := os.ReadFile(filepath.Join(v.rootPath, "opts.json")); err == nil {
|
||||
opts := optsConfig{}
|
||||
if err := json.Unmarshal(b, &opts); err != nil {
|
||||
|
@ -88,9 +93,6 @@ func New(scope string, rootIdentity idtools.Identity) (*Root, error) {
|
|||
if !reflect.DeepEqual(opts, optsConfig{}) {
|
||||
v.opts = &opts
|
||||
}
|
||||
// unmount anything that may still be mounted (for example, from an
|
||||
// unclean shutdown). This is a no-op on windows
|
||||
unmount(v.path)
|
||||
}
|
||||
r.volumes[name] = v
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue