git: plan9front

Download patch

ref: 1a8d33332b0c1822a67046409666f6ec8ff6a0cc
parent: fb782398bfec11a5b6d2b9eba3ba51d353708646
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Jul 1 23:01:02 EDT 2025

gefs: check should take the mutlk, not make the fs readonly

readonly isn't designed to be a temporary state, so things
get a bit unhappy when the fs goes read only

--- a/sys/src/cmd/gefs/check.c
+++ b/sys/src/cmd/gefs/check.c
@@ -190,6 +190,7 @@
 			}
 			r = n;
 		}
+fprint(2, "check arena %d\n", i);
 		if(!checklog(fd, a->loghd))
 			fprint(fd, "arena %d: broken freelist\n", i);
 		qunlock(a);
@@ -260,8 +261,8 @@
 	Blk *b;
 
 	ok = 1;
-	ainc(&fs->rdonly);
 	epochwait();
+	qlock(&fs->mutlk);
 	if(waserror()){
 		fprint(fd, "error checking %s\n", errmsg());
 		return 0;
@@ -317,7 +318,7 @@
 		poperror();
 	}
 	btexit(&s);
-	adec(&fs->rdonly);
+	qunlock(&fs->mutlk);
 	poperror();
 	return ok;
 }
--