shithub: gefs

Download patch

ref: d1f3032377b2df70333317c10499790a40b90194
parent: fc81383d17b7b2c7379456470a5781f5a90462c5
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Dec 26 00:00:33 EST 2023

fs: sync the dl before updating the tree, add write barrier before syncing snaps

--- a/fs.c
+++ b/fs.c
@@ -73,6 +73,10 @@
 		nexterror();
 	}
 
+	/* 
+	 * Wait for data that we're syncing to hit disk
+	 */
+	wrbarrier();
 	/*
 	 * pass 0: Update all open snapshots, and
 	 *  pack the blocks we want to sync. Snap
@@ -83,10 +87,10 @@
          */
 	qlock(&fs->mutlk);
 	lock(&fs->mountlk);
+	dlsync();
 	for(mnt = fs->mounts; mnt != nil; mnt = mnt->next)
 		updatesnap(&mnt->root, mnt->root, mnt->name);
 	unlock(&fs->mountlk);
-	dlsync();
 	for(i = 0; i < fs->narena; i++){
 		a = &fs->arenas[i];
 		qlock(a);