From b08b51b4174d484fc43a4e70f3acdf92016987cf Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 20 Feb 2019 11:24:15 -0500 Subject: [PATCH] BFS: Fix vising attribute runs in FileSystemVisitor. See inline comment. Fixes "vnode refcount > 0" assert failures while running checkfs after yesterday's commits. --- src/add-ons/kernel/file_systems/bfs/FileSystemVisitor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/file_systems/bfs/FileSystemVisitor.cpp b/src/add-ons/kernel/file_systems/bfs/FileSystemVisitor.cpp index c102f41ade..779f1ebae8 100644 --- a/src/add-ons/kernel/file_systems/bfs/FileSystemVisitor.cpp +++ b/src/add-ons/kernel/file_systems/bfs/FileSystemVisitor.cpp @@ -161,8 +161,14 @@ FileSystemVisitor::Next() // If the inode has an attribute directory that we want to visit, // push it on the stack if ((fFlags & VISIT_ATTRIBUTE_DIRECTORIES) - && !inode->Attributes().IsZero()) { + && !inode->Attributes().IsZero()) { fStack.Push(inode->Attributes()); + + // We may already be keeping the associated Vnode, so we can't + // just call vnode.Keep() here, but rather acquire another reference + // to it specifically. + Vnode attrNode(fVolume, inode->Attributes()); + attrNode.Keep(); } bool visitingCurrentDirectory = inode->BlockRun() == fCurrent;