Skip to content

Commit f8538b5

Browse files
committed
Fix error case in Windows layer cleanup
ForceRemoveAll has special logic on Windows for cleaning up a Windows snapshotter directory. The logic was missing proper handling for an error case that can be returned in some cases. This fixes the CI failure seen in #5326. Signed-off-by: Kevin Parsons <[email protected]>
1 parent 6636e36 commit f8538b5

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sys/filesys_windows.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ func cleanupWCOWLayer(layerPath string) error {
311311
HomeDir: filepath.Dir(layerPath),
312312
}
313313

314-
// ERROR_DEV_NOT_EXIST is returned if the layer is not currently prepared.
314+
// ERROR_DEV_NOT_EXIST is returned if the layer is not currently prepared or activated.
315+
// ERROR_FLT_INSTANCE_NOT_FOUND is returned if the layer is currently activated but not prepared.
315316
if err := hcsshim.UnprepareLayer(info, filepath.Base(layerPath)); err != nil {
316-
if hcserror, ok := err.(*hcsshim.HcsError); !ok || hcserror.Err != windows.ERROR_DEV_NOT_EXIST {
317+
if hcserror, ok := err.(*hcsshim.HcsError); !ok || (hcserror.Err != windows.ERROR_DEV_NOT_EXIST && hcserror.Err != syscall.Errno(windows.ERROR_FLT_INSTANCE_NOT_FOUND)) {
317318
return errors.Wrapf(err, "failed to unprepare %s", layerPath)
318319
}
319320
}

0 commit comments

Comments
 (0)