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
commit 3c1ef1a714
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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
}