Merge pull request #2212 from dmcgowan/fix-overlay-cleanup-race

overlay: fix cleanup directory deletion race
This commit is contained in:
Lantao Liu
2018-03-15 15:13:30 -07:00
committed by GitHub

View File

@@ -309,7 +309,9 @@ func (o *snapshotter) Cleanup(ctx context.Context) error {
}
func (o *snapshotter) cleanupDirectories(ctx context.Context) ([]string, error) {
ctx, t, err := o.ms.TransactionContext(ctx, false)
// Get a write transaction to ensure no other write transaction can be entered
// while the cleanup is scanning.
ctx, t, err := o.ms.TransactionContext(ctx, true)
if err != nil {
return nil, err
}