summaryrefslogtreecommitdiff
path: root/lib/btrfsprogs/btrfsinspect
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-01-07 14:03:47 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-02-12 16:20:05 -0700
commit6097c4c634b8644e4ac1e0520f39a6bc501d227d (patch)
tree9572a6f6944b8d3cc822919747430181e35483d4 /lib/btrfsprogs/btrfsinspect
parentf99c76b597e37a94f6a23345c36f42e70e71c67c (diff)
rebuildnodes: Don't deadlock if the cpu goroutine panics
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect')
-rw-r--r--lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
index 9f7ce9f..bc4d7c9 100644
--- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
+++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go
@@ -264,10 +264,14 @@ func (o *rebuilder) processSettledItemQueue(ctx context.Context) error {
return err
}
ctx := dlog.WithField(ctx, "btrfsinspect.rebuild-nodes.rebuild.process.item", key)
- itemChan <- keyAndBody{
+ item := keyAndBody{
keyAndTree: key,
Body: o.rebuilt.Tree(ctx, key.TreeID).ReadItem(ctx, key.Key),
}
+ select {
+ case itemChan <- item:
+ case <-ctx.Done():
+ }
}
return nil
})