git: 9front

Download patch

ref: 286658c69aac5546c0b0df4824b7383771e8b165
parent: d3392a19dbf9d1ee5c07cdd90f0ea725b5c0a10c
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;
 }
--