shithub: gefs

Download patch

ref: afc09a56c981be2eb32673c09e778b216c32ec26
parent: 1a37a6bb30e050e20e53e36abeb8fda10398f3f9
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Dec 2 19:37:48 EST 2023

fs: lock mounts while snapshotting.
fs: lock mounts while snapshotting, skip clean trees

--- a/fs.c
+++ b/fs.c
@@ -2352,7 +2352,10 @@
 		chsend(fs->admchan, a);
 
 		tmnow(&now, nil);
+		lock(&fs->mountlk);
 		for(mnt = fs->mounts; mnt != nil; mnt = mnt->next){
+			if(!mnt->root->dirty)
+				continue;
 			if(now.yday != then.yday){
 				snprint(buf, sizeof(buf),
 					"%s@day.%τ", mnt->name, tmfmt(&now, "YYYY.MM.DD[_]hh:mm:ss"));
@@ -2373,6 +2376,7 @@
 				snapmsg("main", mnt->minutely[m], Lauto);
 			}
 		}
+		unlock(&fs->mountlk);
 		if(now.hour != then.hour)
 			h = (h+1)%24;
 		if(now.min != then.min)