overlay: fix cleanup directory deletion race
Fixes a bug where a writable transaction may create or make changes to a directory while the cleanup is running, leading to removal of a directory which will be referenced. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
parent
b307df2723
commit
94cf25f7db
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user