fix: ensure pin rm takes a lock

This commit is contained in:
Dirk McCormick 2019-06-12 14:59:06 -04:00
parent ffb8bf4c88
commit 4ead108a80

View File

@ -67,6 +67,10 @@ func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOpti
return err
}
// Note: after unpin the pin sets are flushed to the blockstore, so we need
// to take a lock to prevent a concurrent garbage collection
defer api.blockstore.PinLock().Unlock()
if err = api.pinning.Unpin(ctx, rp.Cid(), settings.Recursive); err != nil {
return err
}