mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
compute deterministic paths in debugInodeStatus
Summary: InodeBase::getPath is not deterministic under concurrent renames. Instead, thread the paths down through the recursion so they're consistent. Reviewed By: genevievehelsel Differential Revision: D24297724 fbshipit-source-id: 3e8664ce2bc5159e464d1d76ed37294c4eac1709
This commit is contained in:
parent
6dac514fae
commit
83dbe9d985
@ -3454,15 +3454,13 @@ size_t TreeInode::unloadChildrenLastAccessedBefore(const timespec& cutoff) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void TreeInode::getDebugStatus(vector<TreeInodeDebugInfo>& results) const {
|
||||
void TreeInode::getDebugStatus(
|
||||
vector<TreeInodeDebugInfo>& results,
|
||||
const RelativePath& myPath) const {
|
||||
TreeInodeDebugInfo info;
|
||||
*info.inodeNumber_ref() = getNodeId().get();
|
||||
*info.refcount_ref() = debugGetFuseRefcount();
|
||||
|
||||
auto myPath = getPath();
|
||||
if (myPath.has_value()) {
|
||||
*info.path_ref() = myPath.value().stringPiece().str();
|
||||
}
|
||||
*info.path_ref() = myPath.stringPiece().str();
|
||||
|
||||
vector<std::pair<PathComponent, InodePtr>> childInodes;
|
||||
{
|
||||
@ -3548,10 +3546,10 @@ void TreeInode::getDebugStatus(vector<TreeInodeDebugInfo>& results) const {
|
||||
// results. We do this separately from the loop above just to order the
|
||||
// results nicely: parents appear before their children, and children
|
||||
// are sorted alphabetically (since contents_.entries are sorted).
|
||||
for (const auto& childData : childInodes) {
|
||||
auto childTree = childData.second.asTreePtrOrNull();
|
||||
for (const auto& [childName, childInode] : childInodes) {
|
||||
auto childTree = childInode.asTreePtrOrNull();
|
||||
if (childTree) {
|
||||
childTree->getDebugStatus(results);
|
||||
childTree->getDebugStatus(results, myPath + childName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,9 @@ class TreeInode final : public InodeBaseMetadata<DirContents> {
|
||||
* This populates the results argument with TreeInodeDebugInfo objects for
|
||||
* this TreeInode and all subdirectories inside of it.
|
||||
*/
|
||||
void getDebugStatus(std::vector<TreeInodeDebugInfo>& results) const;
|
||||
void getDebugStatus(
|
||||
std::vector<TreeInodeDebugInfo>& results,
|
||||
const RelativePath& myPath) const;
|
||||
|
||||
/**
|
||||
* Returns a copy of this inode's metadata.
|
||||
|
@ -1223,7 +1223,7 @@ void EdenServiceHandler::debugInodeStatus(
|
||||
auto edenMount = server_->getMount(*mountPoint);
|
||||
|
||||
auto inode = inodeFromUserPath(*edenMount, *path).asTreePtr();
|
||||
inode->getDebugStatus(inodeInfo);
|
||||
inode->getDebugStatus(inodeInfo, RelativePath{*path});
|
||||
}
|
||||
|
||||
void EdenServiceHandler::debugOutstandingFuseCalls(
|
||||
|
Loading…
Reference in New Issue
Block a user