@cryptotaxi247 / kubo / commits / b0ea0b4d7

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

Fix: ensure pin rm takes a lock

Steven Allen committed Jun 12, 2019 at 13:26 UTC b0ea0b4d7dd32fbc4d49a0d9348066a1e60c409e
1 file changed +4
core/coreapi/pin.go
+4
@@ -67,6 +67,10 @@ func (api *PinAPI) Rm(ctx context.Context, p path.Path, opts ...caopts.PinRmOpti
67 return err
68 }
69
70 + // Note: after unpin the pin sets are flushed to the blockstore, so we need
71 + // to take a lock to prevent a concurrent garbage collection
72 + defer api.blockstore.PinLock().Unlock()
73 +
74 if err = api.pinning.Unpin(ctx, rp.Cid(), settings.Recursive); err != nil {
75 return err
76 }