ref: e2994142e890cd2ac79cc9ac3b76900ffce420b4
parent: b659452249216050f1d2f7f85d3b04220204a293
author: Ori Bernstein <[email protected]>
date: Mon May 13 21:26:40 EDT 2024
fs: handle going readonly when syncing
--- a/fs.c
+++ b/fs.c
@@ -67,8 +67,6 @@
int i;
- if(fs->rdonly)
- return;
qlock(&fs->synclk);
if(waserror()){
fprint(2, "failed to sync: %s\n", errmsg());
@@ -2425,6 +2423,8 @@
tracem("syncreq");
if(!fs->snap.dirty && !am->halt)
continue;
+ if(agetl(&fs->rdonly))
+ goto Justhalt;
if(waserror()){
fprint(2, "sync error: %s\n", errmsg());
ainc(&fs->rdonly);
@@ -2474,6 +2474,7 @@
}
}
+Justhalt:
if(am->halt){
assert(fs->snapdl.hd.addr == -1);
assert(fs->snapdl.tl.addr == -1);
@@ -2485,6 +2486,10 @@
case AOsnap:
tracem("snapreq");
+ if(agetl(&fs->rdonly)){
+ fprint(2, "read only fs");
+ continue;
+ }
if(waserror()){
fprint(2, "taking snap: %s\n", errmsg());
ainc(&fs->rdonly);