mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #20372 from tonistiigi/fix-empty-diffid
Fix migration diffid atomic write
This commit is contained in:
commit
61aa025faf
1 changed files with 11 additions and 2 deletions
|
@ -160,7 +160,12 @@ func calculateLayerChecksum(graphDir, id string, ls checksumCalculator) error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := ioutil.WriteFile(filepath.Join(graphDir, id, migrationDiffIDFileName), []byte(diffID), 0600); err != nil {
|
||||
tmpFile := filepath.Join(graphDir, id, migrationDiffIDFileName+".tmp")
|
||||
if err := ioutil.WriteFile(tmpFile, []byte(diffID), 0600); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := os.Rename(tmpFile, filepath.Join(graphDir, id, migrationDiffIDFileName)); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -423,7 +428,11 @@ func migrateImage(id, root string, ls graphIDRegistrar, is image.Store, ms metad
|
|||
history = parentImg.History
|
||||
}
|
||||
|
||||
diffID, err := ioutil.ReadFile(filepath.Join(root, graphDirName, id, migrationDiffIDFileName))
|
||||
diffIDData, err := ioutil.ReadFile(filepath.Join(root, graphDirName, id, migrationDiffIDFileName))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
diffID, err := digest.ParseDigest(string(diffIDData))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue