shithub: riscv

Download patch

ref: b8d4c6ff17bbfdf6619454bbdbd65612a6d7defb
parent: 546046b46bd920c9da13e46c87efa08ab0c85bfa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Sep 23 13:33:05 EDT 2017

upas/fs: fix putcache(), sub-part messages should never go into the lru

we accidentally added non-top messages (attatchments) to the lru,
resulting in attachments to be freed. this is wrong.

--- a/sys/src/cmd/upas/fs/cache.c
+++ b/sys/src/cmd/upas/fs/cache.c
@@ -100,6 +100,7 @@
 {
 	int n;
 
+	while(!Topmsg(mb, m)) m = m->whole;
 	addlru(mb, m);
 	while(mb->lru != nil && (mb->cached > cachetarg || mb->nlru > 10)){
 		n = 0;