Skip to content

Commit

Permalink
Merge pull request #6444 from dirkmc/fix/pin-rm-add-lock
Browse files Browse the repository at this point in the history
Fix: ensure pin rm takes a lock
  • Loading branch information
Stebalien authored Jun 12, 2019
2 parents ffb8bf4 + 4ead108 commit 3cc3538
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/coreapi/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 3cc3538

Please sign in to comment.