Skip to content

Commit ada96ec

Browse files
Merge pull request #5328 from kevpar/win-ci-cleanup
Fix error case in Windows layer cleanup
2 parents bd4fcf6 + f8538b5 commit ada96ec

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)