mirror of
https://github.com/minio/minio.git
synced 2025-04-24 04:10:43 -04:00
Fix scanner deadlock on lost global lock (#16726)
This commit is contained in:
parent
47dfa62384
commit
d07089ceac
@ -689,9 +689,11 @@ func (z *erasureServerPools) NSScanner(ctx context.Context, updates chan<- DataU
|
|||||||
case updateCloser <- ch:
|
case updateCloser <- ch:
|
||||||
<-ch
|
<-ch
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
mu.Lock()
|
||||||
if firstErr == nil {
|
if firstErr == nil {
|
||||||
firstErr = ctx.Err()
|
firstErr = ctx.Err()
|
||||||
}
|
}
|
||||||
|
defer mu.Unlock()
|
||||||
}
|
}
|
||||||
return firstErr
|
return firstErr
|
||||||
}
|
}
|
||||||
|
@ -412,9 +412,6 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, wa
|
|||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
|
||||||
// Return without saving.
|
|
||||||
return
|
|
||||||
case <-t.C:
|
case <-t.C:
|
||||||
if cache.Info.LastUpdate.Equal(lastSave) {
|
if cache.Info.LastUpdate.Equal(lastSave) {
|
||||||
continue
|
continue
|
||||||
@ -488,10 +485,13 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, wa
|
|||||||
go func(name string) {
|
go func(name string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
for update := range updates {
|
for update := range updates {
|
||||||
bucketResults <- dataUsageEntryInfo{
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
case bucketResults <- dataUsageEntryInfo{
|
||||||
Name: name,
|
Name: name,
|
||||||
Parent: dataUsageRoot,
|
Parent: dataUsageRoot,
|
||||||
Entry: update,
|
Entry: update,
|
||||||
|
}:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(cache.Info.Name)
|
}(cache.Info.Name)
|
||||||
@ -519,10 +519,14 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, wa
|
|||||||
root = cache.flatten(*r)
|
root = cache.flatten(*r)
|
||||||
}
|
}
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
bucketResults <- dataUsageEntryInfo{
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return
|
||||||
|
case bucketResults <- dataUsageEntryInfo{
|
||||||
Name: cache.Info.Name,
|
Name: cache.Info.Name,
|
||||||
Parent: dataUsageRoot,
|
Parent: dataUsageRoot,
|
||||||
Entry: root,
|
Entry: root,
|
||||||
|
}:
|
||||||
}
|
}
|
||||||
// We want to avoid synchronizing up all writes in case
|
// We want to avoid synchronizing up all writes in case
|
||||||
// the results are piled up.
|
// the results are piled up.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user