Merge pull request #45 from filecoin-project/fix/double-runlock

local store: Fix double RUnlock
This commit is contained in:
Łukasz Magiera 2020-06-10 14:27:46 +02:00 committed by GitHub
commit 41f6d62a51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -245,7 +245,6 @@ func (st *Local) AcquireSector(ctx context.Context, sid abi.SectorID, spt abi.Re
sis, err := st.index.StorageBestAlloc(ctx, fileType, spt, pathType) sis, err := st.index.StorageBestAlloc(ctx, fileType, spt, pathType)
if err != nil { if err != nil {
st.localLk.RUnlock()
return SectorPaths{}, SectorPaths{}, xerrors.Errorf("finding best storage for allocating : %w", err) return SectorPaths{}, SectorPaths{}, xerrors.Errorf("finding best storage for allocating : %w", err)
} }
@ -277,7 +276,6 @@ func (st *Local) AcquireSector(ctx context.Context, sid abi.SectorID, spt abi.Re
} }
if best == "" { if best == "" {
st.localLk.RUnlock()
return SectorPaths{}, SectorPaths{}, xerrors.Errorf("couldn't find a suitable path for a sector") return SectorPaths{}, SectorPaths{}, xerrors.Errorf("couldn't find a suitable path for a sector")
} }