mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-19 05:36:58 +00:00
fix(ec): guard ecjFile under its lock in the EC delete path
EcVolume.Close nils ecjFile under ecjFileAccessLock; a delete that resolved its .ecx lookup before a concurrent eviction (the generate-time UnloadEcVolume) could then reach the journal append with a nil fd. Bail with a clear "volume closed" error under the lock instead.
This commit is contained in:
@@ -64,6 +64,14 @@ func (ev *EcVolume) DeleteNeedleFromEcx(needleId types.NeedleId) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close nils ecjFile under this same lock, so a delete that resolved its
|
||||
// .ecx lookup before an eviction (e.g. the generate-time UnloadEcVolume)
|
||||
// can reach here with no journal fd. Bail with a clear error rather than
|
||||
// operating on the closed/nil handle.
|
||||
if ev.ecjFile == nil {
|
||||
return fmt.Errorf("ec volume %d closed", ev.VolumeId)
|
||||
}
|
||||
|
||||
b := make([]byte, types.NeedleIdSize)
|
||||
types.NeedleIdToBytes(b, needleId)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user