Merge pull request #4281 from filecoin-project/steb/seal-race
fix race in unseal
This commit is contained in:
commit
114a1aaffd
@ -290,10 +290,6 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector abi.SectorID, offset s
|
||||
defer opr.Close() // nolint
|
||||
|
||||
padwriter := fr32.NewPadWriter(out)
|
||||
if err != nil {
|
||||
perr = xerrors.Errorf("creating new padded writer: %w", err)
|
||||
return
|
||||
}
|
||||
|
||||
bsize := uint64(size.Padded())
|
||||
if bsize > uint64(runtime.NumCPU())*fr32.MTTresh {
|
||||
@ -302,7 +298,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector abi.SectorID, offset s
|
||||
|
||||
bw := bufio.NewWriterSize(padwriter, int(abi.PaddedPieceSize(bsize).Unpadded()))
|
||||
|
||||
_, err = io.CopyN(bw, opr, int64(size))
|
||||
_, err := io.CopyN(bw, opr, int64(size))
|
||||
if err != nil {
|
||||
perr = xerrors.Errorf("copying data: %w", err)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user