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 committed Jul 4, 2019
1 parent 98e7a3d commit b0ea0b4
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 b0ea0b4

Please sign in to comment.