shithub: front

Download patch

ref: d0f4f620cfba9f857dd15bdbcfc660cc01bc53c5
parent: 437419430645e79a1ab80de5a45a3c4265ca683f
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Sep 23 14:31:46 EDT 2024

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.

--- a/sys/src/cmd/walk.c
+++ b/sys/src/cmd/walk.c
@@ -307,11 +307,10 @@
 	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;
--