File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -149,19 +149,20 @@ func (f *flistModule) cleanUnusedMounts() error {
149
149
return nil
150
150
}
151
151
152
+ // forceUnmountAndRemove tries to fix the clean up of broken mounts by attempting to unmount them first
152
153
func (f * flistModule ) forceUnmountAndRemove (path string ) error {
153
- // Try normal unmount first
154
+ // try normal unmount first
154
155
err := f .system .Unmount (path , 0 )
155
156
if err != nil {
156
157
log .Warn ().Err (err ).Msgf ("normal unmount failed for %s, trying lazy unmount" , path )
157
158
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 )
160
161
if err != nil {
161
162
return errors .Wrapf (err , "lazy unmount also failed for %s" , path )
162
163
}
163
164
}
164
- // Now try to remove the directory
165
+ // try to remove the path after unmount
165
166
if err := os .RemoveAll (path ); err != nil {
166
167
return errors .Wrapf (err , "failed to remove mountpoint %s" , path )
167
168
}
You can’t perform that action at this time.
0 commit comments