diff options
Diffstat (limited to 'lib/btrfsprogs')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go index 2448033..3fc361c 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s2_lostandfound.go @@ -86,8 +86,7 @@ func lostAndFoundNodes(ctx context.Context, fs _FS, nodeScanResults btrfsinspect if orphanedNodes[potentialRoot] > 1 { continue } - walkCtx, cancel := context.WithCancel(ctx) - walkFromNode(walkCtx, fs, potentialRoot, + walkFromNode(ctx, fs, potentialRoot, func(err *btrfstree.TreeError) { // do nothing }, @@ -97,11 +96,11 @@ func lostAndFoundNodes(ctx context.Context, fs _FS, nodeScanResults btrfsinspect if nodeAddr != potentialRoot { delete(orphanedRoots, nodeAddr) } - visitCnt := orphanedNodes[nodeAddr] + 1 - orphanedNodes[nodeAddr] = visitCnt - if visitCnt > 1 { - cancel() + visitCnt, ok := orphanedNodes[nodeAddr] + if visitCnt > 0 || !ok { + return iofs.SkipDir } + orphanedNodes[nodeAddr] = visitCnt + 1 return nil }, }, |