nfs4: Fix _LoadSnapshot comparison logic
* If a ".." entry is present in fNameCache, don't look for a matching
entry in the DirectoryCacheSnapshot.
* Fixes an assert failure reported incidentally in the #19656 ticket,
but is not related to the original reported bug.
This is a correction to 258fce50e0.
The comparison added in that patch is between 2 different types of
directory entry caches that exist in the DirectoryCache class. One of
them caches "..", and the other one doesn't.
Change-Id: I56335271436be18e363f6b164e1fc2de24193bfb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9498
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -224,21 +224,24 @@ DirectoryCache::_LoadSnapshot(bool trash)
|
|||||||
// obtained snapshot that might indicate stale nodes.
|
// obtained snapshot that might indicate stale nodes.
|
||||||
while (!fNameCache.IsEmpty()) {
|
while (!fNameCache.IsEmpty()) {
|
||||||
NameCacheEntry* current = fNameCache.RemoveHead();
|
NameCacheEntry* current = fNameCache.RemoveHead();
|
||||||
bool nodeFound = false;
|
if (strcmp(current->fName, "..") != 0) {
|
||||||
for (SinglyLinkedList<NameCacheEntry>::ConstIterator it
|
bool nodeFound = false;
|
||||||
= newSnapshot->fEntries.GetIterator();
|
for (SinglyLinkedList<NameCacheEntry>::ConstIterator it
|
||||||
NameCacheEntry* snapshotEntry = it.Next();) {
|
= newSnapshot->fEntries.GetIterator();
|
||||||
if (current->fNode == snapshotEntry->fNode
|
NameCacheEntry* snapshotEntry = it.Next();) {
|
||||||
&& strcmp(current->fName, snapshotEntry->fName) == 0) {
|
if (current->fNode == snapshotEntry->fNode
|
||||||
nodeFound = true;
|
&& strcmp(current->fName, snapshotEntry->fName) == 0) {
|
||||||
break;
|
nodeFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!nodeFound) {
|
||||||
|
// The inode-name association that was cached in 'current' is no longer valid.
|
||||||
|
result = fInode->GetFileSystem()->TrashStaleNode(current->fNode);
|
||||||
|
if (result != B_OK)
|
||||||
|
INFORM("_LoadSnapshot: Couldn't free stale node %" B_PRIdINO "\n",
|
||||||
|
current->fNode);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!nodeFound) {
|
|
||||||
// The inode-name association that was cached in 'current' is no longer valid.
|
|
||||||
result = fInode->GetFileSystem()->TrashStaleNode(current->fNode);
|
|
||||||
if (result != B_OK)
|
|
||||||
INFORM("_LoadSnapshot: Couldn't free stale node.\n");
|
|
||||||
}
|
}
|
||||||
delete current;
|
delete current;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user