git: 9front

Download patch

ref: d2854bc91517201d9732a4b6982ccd651f2141d3
parent: 8db44465479407ded8641ec40eaccde52e2720f6
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Nov 22 03:49:41 EST 2018

upas/fs: allow msgincref() with mb->refs == 0

this can happen when the on the final sync when the mailbox
is being freed:

freembox -> mboxdecref -> syncmbox -> wridxfile -> pridx -> insurecache -> msgincref

--- a/sys/src/cmd/upas/fs/mbox.c
+++ b/sys/src/cmd/upas/fs/mbox.c
@@ -1124,7 +1124,7 @@
 void
 msgincref(Mailbox *mb, Message *m)
 {
-	assert(mb->refs > 0);
+	assert(mb->refs >= 0);
 	for(;; m = m->whole){
 		assert(m->refs >= 0);
 		m->refs++;
--