pkg/system.EnsureRemoveAll: don't call Mounted
1. Call to mount.Mounted() is very expensive and it's redundant to call it before Unmount(). 2. Calling mount.Mounted() after an error from Unmount() is questionable -- if umount failed, the mount is probably still there anyway, it doesn't make sense to check it. This should result in faster code with no change in functionality. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
e67f42e21d
commit
f8dbc31b78
1 changed files with 2 additions and 6 deletions
|
@ -63,12 +63,8 @@ func EnsureRemoveAll(dir string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if mounted, _ := mount.Mounted(pe.Path); mounted {
|
||||
if e := mount.Unmount(pe.Path); e != nil {
|
||||
if mounted, _ := mount.Mounted(pe.Path); mounted {
|
||||
return errors.Wrapf(e, "error while removing %s", dir)
|
||||
}
|
||||
}
|
||||
if e := mount.Unmount(pe.Path); e != nil {
|
||||
return errors.Wrapf(e, "error while removing %s", dir)
|
||||
}
|
||||
|
||||
if exitOnErr[pe.Path] == maxRetry {
|
||||
|
|
Loading…
Add table
Reference in a new issue