Skip to content

Commit 06e9d4b

Browse files
committed
use f.system instead of syscall
1 parent 7947b83 commit 06e9d4b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/flist/cleanup.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,20 @@ func (f *flistModule) cleanUnusedMounts() error {
149149
return nil
150150
}
151151

152+
// forceUnmountAndRemove tries to fix the clean up of broken mounts by attempting to unmount them first
152153
func (f *flistModule) forceUnmountAndRemove(path string) error {
153-
// Try normal unmount first
154+
// try normal unmount first
154155
err := f.system.Unmount(path, 0)
155156
if err != nil {
156157
log.Warn().Err(err).Msgf("normal unmount failed for %s, trying lazy unmount", path)
157158

158-
// Try lazy unmount (MNT_DETACH)
159-
err = syscall.Unmount(path, syscall.MNT_DETACH)
159+
// try lazy unmount
160+
err = f.system.Unmount(path, syscall.MNT_DETACH)
160161
if err != nil {
161162
return errors.Wrapf(err, "lazy unmount also failed for %s", path)
162163
}
163164
}
164-
// Now try to remove the directory
165+
// try to remove the path after unmount
165166
if err := os.RemoveAll(path); err != nil {
166167
return errors.Wrapf(err, "failed to remove mountpoint %s", path)
167168
}

0 commit comments

Comments
 (0)