pkg/mount.RecursiveUnmount(): don't call Mounted()

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.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-03-06 15:19:52 -08:00
parent f8dbc31b78
commit 5bd02b8a86

View file

@ -144,9 +144,7 @@ func RecursiveUnmount(target string) error {
err = unmount(m.Mountpoint, mntDetach) err = unmount(m.Mountpoint, mntDetach)
if err != nil { if err != nil {
if i == len(mounts)-1 { // last mount if i == len(mounts)-1 { // last mount
if mounted, e := Mounted(m.Mountpoint); e != nil || mounted { return err
return err
}
} else { } else {
// This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem // This is some submount, we can ignore this error for now, the final unmount will fail if this is a real problem
logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint) logrus.WithError(err).Warnf("Failed to unmount submount %s", m.Mountpoint)