Merge pull request #6444 from dirkmc/fix/pin-rm-add-lock

Fix: ensure pin rm takes a lock
This commit is contained in:
Steven Allen 2019-06-12 13:26:49 -07:00
parent 98e7a3d981
commit b0ea0b4d7d

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
}