Fix scanner deadlock on lost global lock (#16726)

This commit is contained in:
Klaus Post
2023-03-01 06:34:45 +01:00
committed by GitHub
parent 47dfa62384
commit d07089ceac
2 changed files with 11 additions and 5 deletions
+2
View File
@@ -689,9 +689,11 @@ func (z *erasureServerPools) NSScanner(ctx context.Context, updates chan<- DataU
case updateCloser <- ch:
<-ch
case <-ctx.Done():
mu.Lock()
if firstErr == nil {
firstErr = ctx.Err()
}
defer mu.Unlock()
}
return firstErr
}