walk: qid.vers should be ignored (thanks BurnZeZ)

No idea who committed this in 2022 as its "glenda@9front.local",
but as qid.vers is incremented for each write and we definitely
should not use it as the cache tag.

Also, the initial code was stolen from du.c as the comment says,
and that one does the right thing.
This commit is contained in:
cinap_lenrek 2024-09-23 18:31:46 +00:00
parent 4374194306
commit d0f4f620cf

View file

@ -307,11 +307,10 @@ seen(Dir *dir)
int i;
Cache *c;
c = &cache[(dir->qid.path^dir->qid.vers)&(NCACHE-1)];
c = &cache[dir->qid.path&(NCACHE-1)];
dp = c->cache;
for(i=0; i<c->n; i++, dp++)
if(dir->qid.path == dp->qid.path &&
dir->qid.vers == dp->qid.vers &&
dir->type == dp->type &&
dir->dev == dp->dev)
return 1;