storagefsm: Fix unsealedInfoMap.lk init race
This commit is contained in:
parent
32dcfb4842
commit
299e72458e
3
extern/storage-sealing/fsm.go
vendored
3
extern/storage-sealing/fsm.go
vendored
@ -409,8 +409,9 @@ func (m *Sealing) restartSectors(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
m.unsealedInfoMap.lk.Lock()
|
||||
// m.unsealedInfoMap.lk.Lock() taken early in .New to prevent races
|
||||
defer m.unsealedInfoMap.lk.Unlock()
|
||||
|
||||
for _, sector := range trackedSectors {
|
||||
if err := m.sectors.Send(uint64(sector.SectorNumber), SectorRestart{}); err != nil {
|
||||
log.Errorf("restarting sector %d: %+v", sector.SectorNumber, err)
|
||||
|
2
extern/storage-sealing/sealing.go
vendored
2
extern/storage-sealing/sealing.go
vendored
@ -145,6 +145,8 @@ func New(api SealingAPI, fc FeeConfig, events Events, maddr address.Address, ds
|
||||
|
||||
s.sectors = statemachine.New(namespace.Wrap(ds, datastore.NewKey(SectorStorePrefix)), s, SectorInfo{})
|
||||
|
||||
s.unsealedInfoMap.lk.Lock() // released after initialized in .Run()
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user